auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean isSatisfied(Map<String, Object> inputs) { <START> String startTimeConfig = (String) module.getConfiguration().get(START_TIME); <END> String endTimeConfig = (String) module.getConfiguration().get(END_TIME); if (startTimeConfig == null || endTimeConfig == null) { logger.error("Time condition with id is not well configured: startTime={} endTime = {}", module.getId(), startTimeConfig, endTimeConfig); return false; } LocalTime currentTime = LocalTime.now().truncatedTo(ChronoUnit.MINUTES); LocalTime startTime = LocalTime.parse(startTimeConfig).truncatedTo(ChronoUnit.MINUTES); LocalTime endTime = LocalTime.parse(endTimeConfig).truncatedTo(ChronoUnit.MINUTES); if (currentTime.equals(startTime)) { logger.debug("Time condition with id evaluated, that the current time equals the start time: {}", module.getId(), currentTime, startTime); return true; } if (startTime.isBefore(endTime)) { if (currentTime.isAfter(startTime) && currentTime.isBefore(endTime)) { logger.debug("Time condition with id evaluated, that is between and {}.", module.getId(), currentTime, startTime, endTime); return true; } } else if (currentTime.isAfter(LocalTime.MIDNIGHT) && currentTime.isBefore(endTime) || currentTime.isAfter(startTime) && currentTime.isBefore(LocalTime.MAX)) { logger.debug("Time condition with id evaluated, that is between and {}, or between and {}.", module.getId(), currentTime, LocalTime.MIDNIGHT, endTime, startTime, LocalTime.MAX.truncatedTo(ChronoUnit.MINUTES)); return true; } return false; }</code><technical_language>automation handler is recreated configuration change. Please extract configuration in contructor</technical_language>

Target:
public boolean isSatisfied(Map<String, Object> inputs) { if (startTime == null || endTime == null) { logger.warn("Time condition with id is not well configured: startTime={} endTime = {}", module.getId(), startTime, endTime); return false; } LocalTime currentTime = LocalTime.now().truncatedTo(ChronoUnit.MINUTES); if (currentTime.equals(startTime)) { logger.debug("Time condition with id evaluated, that the current time equals the start time: {}", module.getId(), currentTime, startTime); return true; } if (startTime.isBefore(endTime)) { if (currentTime.isAfter(startTime) && currentTime.isBefore(endTime)) { logger.debug("Time condition with id evaluated, that is between and {}.", module.getId(), currentTime, startTime, endTime); return true; } } else if (currentTime.isAfter(LocalTime.MIDNIGHT) && currentTime.isBefore(endTime) || currentTime.isAfter(startTime) && currentTime.isBefore(LocalTime.MAX)) { logger.debug("Time condition with id evaluated, that is between and {}, or between and {}.", module.getId(), currentTime, LocalTime.MIDNIGHT, endTime, startTime, LocalTime.MAX.truncatedTo(ChronoUnit.MINUTES)); return true; } return false; }
Source:
<code>public void openAboutPage(){ <START> String userGuideUrl = "<LINK_0>"; <END> Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(userGuideUrl)); startActivity(intent); }</code><technical_language>this a constant ApplicationConstants</technical_language>

Target:
public void openAboutPage(){ String userGuideUrl = ApplicationConstants.USER_GUIDE; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(userGuideUrl)); startActivity(intent); }
Source:
<code>public void DeleteAndRestoreMapTests_007_SysOpCanRestoreMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); <START> InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore); <END> selectedMap.verifyMapOpened(); selectedMap.verifyMapDeletedMsg(); selectedMap.restoreMap(); selectedMap.verifyMapDeletedMsgNotVisible(); }</code><technical_language>suggest another MapID for 006 007 break dependency 001 002 successful</technical_language>

Target:
public void DeleteAndRestoreMapTests_007_SysOpCanRestoreMap() { WikiBasePageObject base = new WikiBasePageObject(driver); base.logInCookie(credentials.userNameSysop, credentials.passwordSysop, wikiURL); InteractiveMapPageObject selectedMap = base.openInteractiveMapById(wikiURL, InteractiveMapsContent.mapToDeleteAndRestore[3]); selectedMap.verifyMapOpened(); selectedMap.restoreMap(); }
Source:
<code>public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (!baseRequest.isHandled()) { <START> m_log.debug("Failed to process static resource: " + Paths.get(getResourceBase())); <END> } }</code><technical_language>Guard isDebug</technical_language>

Target:
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.handle(target, baseRequest, request, response); if (!baseRequest.isHandled() && m_log.isDebugEnabled()) { m_log.debug("Failed to process static resource: " + Paths.get(getResourceBase())); } }
Source:
<code>static Swagger loadSpecificationFrom(final CamelContext camelContext, final URI uri, SSLContextParameters sslContextParameters) throws IOException { final ObjectMapper mapper = Json.mapper(); final SwaggerParser swaggerParser = new SwaggerParser(); final String uriAsString = uri.toString(); if (sslContextParameters == null) { try (InputStream stream = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uriAsString)) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { <START> return loadSpecificationFalback(swaggerParser, uriAsString, e); <END> } } HttpComponent httpComponent = new HttpComponent(); httpComponent.setSslContextParameters(sslContextParameters); httpComponent.setCamelContext(camelContext); HttpRequestBase httpRequest = createMethod(uriAsString); try (HttpEndpoint e = (HttpEndpoint)httpComponent.createEndpoint(uriAsString); HttpProducer p = (HttpProducer)e.createProducer(); InputStream stream = p.getHttpClient().execute(httpRequest).getEntity().getContent()) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } }</code><technical_language>I meant suggestion return loadSpecificationFallback(swaggerParser, uriAsString, e);</technical_language>

Target:
static Swagger loadSpecificationFrom(final CamelContext camelContext, final URI uri, SSLContextParameters sslContextParameters) throws IOException { final ObjectMapper mapper = Json.mapper(); final SwaggerParser swaggerParser = new SwaggerParser(); final String uriAsString = uri.toString(); if (sslContextParameters == null) { try (InputStream stream = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uriAsString)) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } } HttpComponent httpComponent = new HttpComponent(); httpComponent.setSslContextParameters(sslContextParameters); httpComponent.setCamelContext(camelContext); try (HttpEndpoint e = (HttpEndpoint)httpComponent.createEndpoint(uriAsString); HttpProducer p = (HttpProducer)e.createProducer(); InputStream stream = p.getHttpClient().execute(new HttpGet(uri)).getEntity().getContent()) { return parseInputStream(swaggerParser, mapper, stream); } catch (final Exception e) { return loadSpecificationFallback(swaggerParser, uriAsString, e); } }
Source:
<code>public Volume apply(ServerDrive serverDrive) { VolumeBuilder builder = new VolumeBuilder(); DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid()); builder.id(driveInfo.getUuid()); builder.size(driveInfo.getSize().floatValue()); builder.durable(true); builder.type(Volume.Type.NAS); <START> builder.bootDevice(serverDrive.getBootOrder() > 0); <END> return builder.build(); }</code><technical_language>checking...boot order _greater_ zero means this is a boot device</technical_language>

Target:
public Volume apply(ServerDrive serverDrive) { VolumeBuilder builder = new VolumeBuilder(); DriveInfo driveInfo = api.getDriveInfo(serverDrive.getDriveUuid()); builder.id(driveInfo.getUuid()); builder.size(driveInfo.getSize().floatValue()); builder.durable(true); builder.type(Volume.Type.NAS); builder.bootDevice(serverDrive.getBootOrder() != null); return builder.build(); }
Source:
<code>protected AllTenantOperation(TenantIndex tenantIndex) { <START> this.tenantIndex = tenantIndex; <END> }</code><technical_language>this is public class, check for null explicitly - do in public static methods</technical_language>

Target:
protected AllTenantOperation(TenantIndex tenantIndex) { checkNotNull(tenantIndex); this.tenantIndex = tenantIndex; }
Source:
<code><START> private void initUnregisteredVM() { <END> VM vmFromConfiguration; ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { OvfHelper ovfHelper = new OvfHelper(); vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } } }</code><technical_language>try reusing 'initVmTemplate()' method from: <LINK_0></technical_language>

Target:
private void initUnregisteredVM() { VM vmFromConfiguration = null; OvfHelper ovfHelper = new OvfHelper(); ovfEntityData = getUnregisteredOVFDataDao().getByEntityIdAndStorageDomain(getParameters().getContainerId(), getParameters().getStorageDomainId()); if (ovfEntityData != null) { try { vmFromConfiguration = ovfHelper.readVmFromOvf(ovfEntityData.getOvfData()); } catch (OvfReaderException e) { log.errorFormat("failed to parse a given ovf configuration: \n" + ovfEntityData.getOvfData(), e); } vmFromConfiguration.setVdsGroupId(getParameters().getVdsGroupId()); getParameters().setVm(vmFromConfiguration); getParameters().setDestDomainId(ovfEntityData.getStorageDomainId()); getParameters().setSourceDomainId(ovfEntityData.getStorageDomainId()); } }
Source:
<code>private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileStatus latestUpdatedStatus = null; FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); <START> if (statuses.length > 0) { <END> for (FileStatus status : statuses) { if (latestUpdatedStatus == null) { latestUpdatedStatus = validDump(status.getPath()) ? status : null; } else if (validDump(status.getPath()) && status.getModificationTime() > latestUpdatedStatus.getModificationTime()) { latestUpdatedStatus = status; } } } } return latestUpdatedStatus != null ? latestUpdatedStatus.getPath() : null; }</code><technical_language>need this check</technical_language>

Target:
private Path getPreviousDumpMetadataPath(Path dumpRoot) throws IOException { FileStatus latestValidStatus = null; FileSystem fs = dumpRoot.getFileSystem(conf); if (fs.exists(dumpRoot)) { FileStatus[] statuses = fs.listStatus(dumpRoot); for (FileStatus status : statuses) { LOG.info("Evaluating previous dump dir path:{}", status.getPath()); if (latestValidStatus == null) { latestValidStatus = validDump(fs, status.getPath()) ? status : null; } else if (validDump(fs, status.getPath()) && status.getModificationTime() > latestValidStatus.getModificationTime()) { latestValidStatus = status; } } } Path latestDumpDir = (latestValidStatus == null) ? null : new Path(latestValidStatus.getPath(), ReplUtils.REPL_HIVE_BASE_DIR); LOG.info("Selecting latest valid dump dir as {}", (latestDumpDir == null) ? "null" : latestDumpDir.toString()); return latestDumpDir; }
Source:
<code>private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null, true); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { <START> throw new IllegalStateException(cause); <END> } } } }</code><technical_language>lines this RuntimeException is thrown purpose here. @sobimibos clarify do alternatively? Thanks</technical_language>

Target:
private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null, true); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } }
Source:
<code>private void addLabels(String title, Set<String> set, String filter) { if (set.size() > 0) { add(title); } Iterator<String> iterator = set.iterator(); int i = 0; while (iterator.hasNext()) { String nextString = iterator.next(); if (filter != null && filter.equals(nextString)) { filter = null; if (i >= 5) { add(nextString); i++; break; } } <START> if (i < 5) { <END> add(nextString); i++; } } if (i < set.size()) { add("..."); } }</code><technical_language>Magic</technical_language>

Target:
private void addLabels(String title, Set<String> set, String filter) { if (set.size() > 0) { add(title); } Iterator<String> iterator = set.iterator(); int i = 0; while (iterator.hasNext()) { String nextString = iterator.next(); if (filter != null && filter.equals(nextString)) { filter = null; if (i >= MAX_ROWS) { add(nextString); i++; break; } } if (i < MAX_ROWS) { add(nextString); i++; } } if (i < set.size()) { add("..."); } }
Source:
<code>public SSLContext get() { try { SSLContext sc; <START> sc = SSLContext.getInstance("SSL"); <END> sc.init(null, new TrustManager[] { trustAllCerts }, new SecureRandom()); sc.getDefaultSSLParameters().setProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }); return sc; } catch (Exception e) { throw Throwables.propagate(e); } }</code><technical_language>For consistency, this changed SSLContext.getInstance("TLS")</technical_language>

Target:
public SSLContext get() { try { SSLContext sc; sc = SSLContext.getInstance("TLS"); sc.init(null, new TrustManager[] { trustAllCerts }, new SecureRandom()); sc.getDefaultSSLParameters().setProtocols(new String[] { "TLSv1", "TLSv1.1", "TLSv1.2" }); return sc; } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
<code>private void processNestedFields(TreeMap<String, Type> fieldsMap, List<ElasticsearchColumn> columns, List<String> arrays) { if (fieldsMap.size() == 0) { return; } Entry<String, Type> first = fieldsMap.firstEntry(); String field = first.getKey(); Type type = first.getValue(); if (field.contains(".")) { String prefix = field.substring(0, field.lastIndexOf('.')); ImmutableList.Builder<RowType.Field> fieldsBuilder = ImmutableList.builder(); int size = field.split("\\.").length; Iterator<String> iterator = fieldsMap.navigableKeySet().iterator(); while (iterator.hasNext()) { String name = iterator.next(); if (name.split("\\.").length == size && name.startsWith(prefix)) { fieldsBuilder.add(new RowType.Field(Optional.of(name.substring(name.lastIndexOf('.') + 1)), fieldsMap.get(name))); iterator.remove(); continue; } <START> break; <END> } fieldsMap.put(prefix, RowType.from(fieldsBuilder.build())); } else { boolean newFlattenColumn = columns.stream().noneMatch(column -> column.getName().equalsIgnoreCase(field)); if (newFlattenColumn) { columns.add(new ElasticsearchColumn(field, type, field, type.getDisplayName(), arrays.contains(field), -1)); } fieldsMap.remove(field); } processNestedFields(fieldsMap, columns, arrays); }</code><technical_language>this break loop once, is intended? do need a while loop then, pick element</technical_language>

Target:
private void processNestedFields(TreeMap<String, Type> fieldsMap, List<ElasticsearchColumn> columns, List<String> arrays) { if (fieldsMap.size() == 0) { return; } Entry<String, Type> first = fieldsMap.firstEntry(); String field = first.getKey(); Type type = first.getValue(); if (field.contains(".")) { String prefix = field.substring(0, field.lastIndexOf('.')); ImmutableList.Builder<Field> fieldsBuilder = ImmutableList.builder(); int size = field.split("\\.").length; Iterator<String> iterator = fieldsMap.navigableKeySet().iterator(); while (iterator.hasNext()) { String name = iterator.next(); if (name.split("\\.").length == size && name.startsWith(prefix)) { Optional<String> columnName = Optional.of(name.substring(name.lastIndexOf('.') + 1)); Type columnType = fieldsMap.get(name); Field column = new Field(columnName, columnType); fieldsBuilder.add(column); iterator.remove(); } } fieldsMap.put(prefix, RowType.from(fieldsBuilder.build())); } else { boolean isFlattenColumn = columns.stream() .noneMatch(column -> column.getName().equalsIgnoreCase(field)); if (isFlattenColumn) { columns.add(new ElasticsearchColumn(field, type, field, type.getDisplayName(), arrays.contains(field), -1)); } fieldsMap.remove(field); } processNestedFields(fieldsMap, columns, arrays); }
Source:
<code>public MergeViewerItemProviderConfiguration(AdapterFactory adapterFactory, IDifferenceGroupProvider groupProvider, Predicate<? super EObject> predicate, Comparison comparison, MergeViewerSide side) { <START> this.adapterFactory = adapterFactory; <END> this.groupProvider = groupProvider; this.predicate = predicate; this.comparison = comparison; this.side = side; }</code><technical_language>Please guava Preconditions check arguments. class fields final if supposed immutable (which case), checked for consistency (not null on)</technical_language>

Target:
public MergeViewerItemProviderConfiguration(AdapterFactory adapterFactory, IDifferenceGroupProvider groupProvider, Predicate<? super EObject> predicate, Comparison comparison, MergeViewerSide side) { this.adapterFactory = checkNotNull(adapterFactory); this.groupProvider = checkNotNull(groupProvider); this.predicate = checkNotNull(predicate); this.comparison = checkNotNull(comparison); this.side = checkNotNull(side); }
Source:
<code><START> public boolean insertInStore(long bucketId, long timeBucket, Slice keySlice, Slice valueSlice) <END> { long timeBucketId = store.getTimeBucketAssigner().getTimeBucketFor(timeBucket); if (timeBucketId != -1) { store.putInBucket(bucketId, timeBucketId, keySlice, valueSlice); return true; } return false; }</code><technical_language>This is accessed else. Please this private</technical_language>

Target:
private boolean insertInStore(long bucketId, long timeBucket, Slice keySlice, Slice valueSlice) { long timeBucketId = store.getTimeBucketAssigner().getTimeBucketAndAdjustBoundaries(timeBucket); if (timeBucketId != -1) { store.putInBucket(bucketId, timeBucketId, keySlice, valueSlice); return true; } return false; }
Source:
<code>public PageWithPositionComparator compilePageWithPositionComparator(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) { requireNonNull(sortTypes, "sortTypes is null"); requireNonNull(sortChannels, "sortChannels is null"); requireNonNull(sortOrders, "sortOrders is null"); try { return pageWithPositionComparators.get(new PagesIndexComparatorCacheKey(sortTypes, sortChannels, sortOrders)); <START> } <END> catch (ExecutionException e) { throw new RuntimeException(e.getCause()); } }</code><technical_language>sortChannels -> sortOrders</technical_language>

Target:
public PageWithPositionComparator compilePageWithPositionComparator(List<Type> sortTypes, List<Integer> sortChannels, List<SortOrder> sortOrders) { requireNonNull(sortTypes, "sortTypes is null"); requireNonNull(sortChannels, "sortChannels is null"); requireNonNull(sortOrders, "sortOrders is null"); return pageWithPositionComparators.getUnchecked(new PagesIndexComparatorCacheKey(sortTypes, sortChannels, sortOrders)); }
Source:
<code>public void directSchedulePeriodicallyInputValidation() { try { scheduler.schedulePeriodicallyDirect(null, 1, 1, MINUTES); <START> fail(); <END> } catch (NullPointerException e) { assertEquals("run == null", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, 1, null); fail(); } catch (NullPointerException e) { assertEquals("unit == null", e.getMessage()); } }</code><technical_language>This removed. A negative period sense</technical_language>

Target:
public void directSchedulePeriodicallyInputValidation() { try { scheduler.schedulePeriodicallyDirect(null, 1, 1, MINUTES); fail(); } catch (NullPointerException e) { assertEquals("run == null", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, -1, MINUTES); fail(); } catch (IllegalArgumentException e) { assertEquals("period < 0: -1", e.getMessage()); } try { scheduler.schedulePeriodicallyDirect(new CountingRunnable(), 1, 1, null); fail(); } catch (NullPointerException e) { assertEquals("unit == null", e.getMessage()); } }
Source:
<code>public void testByteDirect() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( <START> ImmutableMap.of(0, TupleDomainFilter.BytesValues.of(new byte[][] {{1}, {17}}, false)), <END> ImmutableMap.of(0, TupleDomainFilter.IS_NULL)); tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of(ImmutableMap.of(0, TupleDomainFilter.BytesValues.of(new byte[][] {{1}, {17}}, false)))); tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }</code><technical_language>import BytesValues</technical_language>

Target:
public void testByteDirect() throws Exception { List<Byte> byteValues = ImmutableList.of(1, 3, 5, 7, 11, 13, 17) .stream() .map(Integer::byteValue) .collect(toList()); List<Map<Integer, TupleDomainFilter>> filters = ImmutableList.of( ImmutableMap.of(0, BytesValues.of(new byte[][] {{1}, {17}}, false)), ImmutableMap.of(0, TupleDomainFilter.IS_NULL)); tester.testRoundTrip(TINYINT, byteValues, ImmutableList.of(ImmutableMap.of(0, BytesValues.of(new byte[][] {{1}, {17}}, false)))); tester.testRoundTripTypes(ImmutableList.of(TINYINT, TINYINT), ImmutableList.of(byteValues, reverse(byteValues)), filters); }
Source:
<code>public ReadyCheckResult ready(Cluster cluster, long nowMs) { Map<Node, List<TopicPartition>> readyNodes = new HashMap<>(); long nextReadyCheckDelayMs = Long.MAX_VALUE; Set<String> unknownLeaderTopics = new HashSet<>(); boolean exhausted = this.free.queued() > 0; for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) { Deque<ProducerBatch> deque = entry.getValue(); synchronized (deque) { ProducerBatch batch = deque.peekFirst(); if (batch != null) { TopicPartition part = entry.getKey(); Node leader = cluster.leaderFor(part); if (leader == null) { unknownLeaderTopics.add(part.topic()); } else if (!isMuted(part, nowMs)) { if (readyNodes.containsKey(leader)) { <START> readyNodes.get(leader).add(entry.getKey()); <END> continue; } long waitedTimeMs = batch.waitedTimeMs(nowMs); boolean backingOff = batch.attempts() > 0 && waitedTimeMs < retryBackoffMs; long timeToWaitMs = backingOff ? retryBackoffMs : lingerMs; boolean full = deque.size() > 1 || batch.isFull(); boolean expired = waitedTimeMs >= timeToWaitMs; boolean sendable = full || expired || exhausted || closed || flushInProgress(); if (sendable && !backingOff) { List<TopicPartition> topicPartitions = new ArrayList<>(); topicPartitions.add(entry.getKey()); readyNodes.put(leader, topicPartitions); } else { long timeLeftMs = Math.max(timeToWaitMs - waitedTimeMs, 0); nextReadyCheckDelayMs = Math.min(timeLeftMs, nextReadyCheckDelayMs); } } } } } return new ReadyCheckResult(readyNodes, nextReadyCheckDelayMs, unknownLeaderTopics); }</code><technical_language>this moved if (sendable && !backingOff) { ? for example, if batch is full, unnecessary put tp readyNodes</technical_language>

Target:
public ReadyCheckResult ready(Cluster cluster, long nowMs) { Map<Node, List<TopicPartition>> readyNodes = new HashMap<>(); long nextReadyCheckDelayMs = Long.MAX_VALUE; Set<String> unknownLeaderTopics = new HashSet<>(); boolean exhausted = this.free.queued() > 0; for (Map.Entry<TopicPartition, Deque<ProducerBatch>> entry : this.batches.entrySet()) { Deque<ProducerBatch> deque = entry.getValue(); synchronized (deque) { ProducerBatch batch = deque.peekFirst(); if (batch != null) { TopicPartition part = entry.getKey(); Node leader = cluster.leaderFor(part); if (leader == null) { unknownLeaderTopics.add(part.topic()); } else if (!isMuted(part, nowMs)) { long waitedTimeMs = batch.waitedTimeMs(nowMs); boolean backingOff = batch.attempts() > 0 && waitedTimeMs < retryBackoffMs; long timeToWaitMs = backingOff ? retryBackoffMs : lingerMs; boolean full = deque.size() > 1 || batch.isFull(); boolean expired = waitedTimeMs >= timeToWaitMs; boolean sendable = full || expired || exhausted || closed || flushInProgress(); if (sendable && !backingOff) { List<TopicPartition> topicPartitions = readyNodes.computeIfAbsent(leader, l -> new ArrayList<>()); topicPartitions.add(entry.getKey()); } else { long timeLeftMs = Math.max(timeToWaitMs - waitedTimeMs, 0); nextReadyCheckDelayMs = Math.min(timeLeftMs, nextReadyCheckDelayMs); } } } } } return new ReadyCheckResult(readyNodes, nextReadyCheckDelayMs, unknownLeaderTopics); }
Source:
<code>public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (count!=0) { long d = end - now; if (d<0) { return false; } <START> wait(d / 1000L); <END> now = System.nanoTime(); } return true; }</code><technical_language>1ms=10^6ns</technical_language>

Target:
public synchronized boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { long now = System.nanoTime(); long end = now + unit.toNanos(timeout); while (count!=0) { long d = end - now; if (d<0) { return false; } wait(TimeUnit.NANOSECONDS.toMillis(d)); now = System.nanoTime(); } return true; }
Source:
<code>static String createKey(Request data, StringBuilder builder) { if (!TextUtils.isEmpty(data.key)) { <START> String path = data.key; <END> builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else if (data.uri != null) { String path = data.uri.toString(); builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else { builder.ensureCapacity(KEY_PADDING); builder.append(data.resourceId); } builder.append('\n'); if (data.rotationDegrees != 0) { builder.append("rotation:").append(data.rotationDegrees); if (data.hasRotationPivot) { builder.append('@').append(data.rotationPivotX).append('x').append(data.rotationPivotY); } builder.append('\n'); } if (data.targetWidth != 0) { builder.append("resize:").append(data.targetWidth).append('x').append(data.targetHeight); builder.append('\n'); } if (data.centerCrop) { builder.append("centerCrop\n"); } else if (data.centerInside) { builder.append("centerInside\n"); } if (data.transformations != null) { for (int i = 0, count = data.transformations.size(); i < count; i++) { builder.append(data.transformations.get(i).key()); builder.append('\n'); } } return builder.toString(); }</code><technical_language>"path" -> "key"</technical_language>

Target:
static String createKey(Request data, StringBuilder builder) { if (data.stableKey != null) { String stableKey = data.stableKey; builder.ensureCapacity(stableKey.length() + KEY_PADDING); builder.append(stableKey); } else if (data.uri != null) { String path = data.uri.toString(); builder.ensureCapacity(path.length() + KEY_PADDING); builder.append(path); } else { builder.ensureCapacity(KEY_PADDING); builder.append(data.resourceId); } builder.append('\n'); if (data.rotationDegrees != 0) { builder.append("rotation:").append(data.rotationDegrees); if (data.hasRotationPivot) { builder.append('@').append(data.rotationPivotX).append('x').append(data.rotationPivotY); } builder.append('\n'); } if (data.targetWidth != 0) { builder.append("resize:").append(data.targetWidth).append('x').append(data.targetHeight); builder.append('\n'); } if (data.centerCrop) { builder.append("centerCrop\n"); } else if (data.centerInside) { builder.append("centerInside\n"); } if (data.transformations != null) { for (int i = 0, count = data.transformations.size(); i < count; i++) { builder.append(data.transformations.get(i).key()); builder.append('\n'); } } return builder.toString(); }
Source:
<code>private void readChunk() throws IOException { <START> int hlen = din.readInt(); <END> byte chunkType = din.readByte(); long readTime = System.currentTimeMillis(); long intervalMillis = readTime - lastReadTime.getAndSet(readTime); switch (chunkType) { case NGConstants.CHUNKTYPE_STDIN: InputStream chunkStream = readPayload(in, hlen); synchronized (this) { if (remaining != 0) { throw new IOException("Data received before stdin stream was emptied"); } LOG.log(Level.FINEST, "Got stdin chunk, len {0}", hlen); stdin = chunkStream; remaining = hlen; notifyAll(); } break; case NGConstants.CHUNKTYPE_STDIN_EOF: LOG.log(Level.FINEST, "Got stdin closed chunk"); setEof(); break; case NGConstants.CHUNKTYPE_HEARTBEAT: LOG.log(Level.FINEST, "Got client heartbeat"); ArrayList<NGHeartbeatListener> listeners; synchronized (this) { listeners = new ArrayList<>(heartbeatListeners); } for (NGHeartbeatListener listener : listeners) { listener.heartbeatReceived(intervalMillis); } break; default: LOG.log(Level.WARNING, "Unknown chunk type: {0}", (char) chunkType); throw new IOException("Unknown stream type: " + (char) chunkType); } }</code><technical_language>hlen is a descriptive name. please rename it</technical_language>

Target:
private void readChunk() throws IOException { int chunkLen = din.readInt(); byte chunkType = din.readByte(); long readTime = System.currentTimeMillis(); switch (chunkType) { case NGConstants.CHUNKTYPE_STDIN: InputStream chunkStream = readPayload(in, chunkLen); synchronized (this) { if (remaining != 0) { throw new IOException("Data received before stdin stream was emptied"); } LOG.log(Level.FINEST, "Got stdin chunk, len {0}", chunkLen); stdin = chunkStream; remaining = chunkLen; notifyAll(); } break; case NGConstants.CHUNKTYPE_STDIN_EOF: LOG.log(Level.FINEST, "Got stdin closed chunk"); setEof(); break; case NGConstants.CHUNKTYPE_HEARTBEAT: LOG.log(Level.FINEST, "Got client heartbeat"); ArrayList<NGHeartbeatListener> listeners; synchronized (this) { listeners = new ArrayList<>(heartbeatListeners); } for (NGHeartbeatListener listener : listeners) { listener.heartbeatReceived(); } break; default: LOG.log(Level.WARNING, "Unknown chunk type: {0}", (char) chunkType); throw new IOException("Unknown stream type: " + (char) chunkType); } }
Source:
<code>public boolean runReruns(HttpRequestProcessorSelector selector) { boolean useful = false; while (true) { RetryHolder retryHolder = getNextRerun(); if (retryHolder != null) { useful = true; <START> if (!retryHolder.retry.tryRerun(selector)) { <END> reschedule(retryHolder.retry, retryHolder.retry.getAttemptDetails().attempt + 1, retryHolder.retry.getAttemptDetails().waitStartTimestamp); } } else { return useful; } } }</code><technical_language>queue is full exception out of this method unhandled</technical_language>

Target:
public boolean runReruns(HttpRequestProcessorSelector selector) { boolean useful = false; while (true) { Retry retry = getNextRerun(); if (retry != null) { useful = true; if (!retry.tryRerun(selector, this)) { try { reschedule(retry, retry.getAttemptDetails().attempt + 1, retry.getAttemptDetails().waitStartTimestamp); } catch (RetryFailedOperationException e) { retry.fail(selector, e); } } } else { return useful; } } }
Source:
<code>private void fireOrdered(Set<StoreEventListener<K, V>> listeners, Deque<FireableStoreEventHolder<K, V>> events) { for (FireableStoreEventHolder<K, V> fireableEvent : events) { fireableEvent.markFireable(); BlockingQueue<FireableStoreEventHolder<K, V>> orderedQueue = getOrderedQueue(fireableEvent); FireableStoreEventHolder<K, V> head = orderedQueue.peek(); if (head == fireableEvent) { if (head.markFired()) { for (StoreEventListener<K, V> listener : listeners) { head.fireOn(listener); } orderedQueue.poll(); } else { fireableEvent.waitTillFired(); } fireWaiters(listeners, orderedQueue); } else { try { fireableEvent.waitTillFired(); } catch (RuntimeException e) { <START> throw new RuntimeException("can't wait anymore\nqueue = " + orderedQueue + "\n events = " + events, e); <END> } } } }</code><technical_language>changes in - for debug purpose</technical_language>

Target:
private void fireOrdered(Set<StoreEventListener<K, V>> listeners, Deque<FireableStoreEventHolder<K, V>> events) { for (FireableStoreEventHolder<K, V> fireableEvent : events) { fireableEvent.markFireable(); BlockingQueue<FireableStoreEventHolder<K, V>> orderedQueue = getOrderedQueue(fireableEvent); FireableStoreEventHolder<K, V> head = orderedQueue.peek(); if (head == fireableEvent) { if (head.markFired()) { for (StoreEventListener<K, V> listener : listeners) { head.fireOn(listener); } orderedQueue.poll(); } else { fireableEvent.waitTillFired(); } fireWaiters(listeners, orderedQueue); } else { fireableEvent.waitTillFired(); } } }
Source:
<code><START> @Override public void onSaveInstanceState(@NonNull Bundle outState) { <END> super.onSaveInstanceState(outState); if (mQuickStartAdapter != null) { outState.putBoolean(KEY_COMPLETED_TASKS_LIST_EXPANDED, mQuickStartAdapter.isCompletedTasksListExpanded()); } }</code><technical_language>suggestion @Override public void onSaveInstanceState(@NonNull Bundle outState) { move @Override annotation a separate line method declaration for code style consistency</technical_language>

Target:
public void onSaveInstanceState(@NonNull Bundle outState) { super.onSaveInstanceState(outState); if (mQuickStartAdapter != null) { outState.putBoolean(KEY_COMPLETED_TASKS_LIST_EXPANDED, mQuickStartAdapter.isCompletedTasksListExpanded()); } }
Source:
<code>private void startGridAndPopulateCache(int nodes) throws Exception { startGrids(NODE_CNT - 1); startClientGrid(NODE_CNT - 1); <START> <END> IgniteCache<Long, String> cache = grid(0).cache(CACHE_NAME); for (int i = 0; i < KEY_CNT; i++) cache.put((long)i, String.valueOf(i)); }</code><technical_language>Removed condition: if (getTestIgniteInstanceIndex(igniteInstanceName) != 0) cfg.setClientMode(true); means, nodes, index=0, client nodes, i.e. _one server multiple clients_, lines: startGrids(NODE_CNT - 1); startClientGrid(NODE_CNT - 1); start _multiple servers client._</technical_language>

Target:
private void startGridAndPopulateCache(int nodes) throws Exception { startGrid(0); startClientGridsMultiThreaded(1, NODE_CNT - 1); IgniteCache<Long, String> cache = grid(0).cache(CACHE_NAME); for (int i = 0; i < KEY_CNT; i++) cache.put((long)i, String.valueOf(i)); }
Source:
<code>public void log_when_sonarqube_is_joining_a_cluster () throws IOException, InterruptedException, IllegalAccessException, NoSuchFieldException { TestAppSettings settings = new TestAppSettings(); settings.set(ProcessProperties.CLUSTER_ENABLED, "true"); settings.set(ProcessProperties.CLUSTER_NAME, "sonarqube"); Logger logger = mock(Logger.class); AppStateClusterImpl.setLogger(logger); try (AppStateClusterImpl appStateCluster = new AppStateClusterImpl(settings)) { <START> verify(logger, times(1)) <END> .info(eq("Joined the cluster that contains the following hosts : [{}]"), eq("sonarqube"), anyString()); } }</code><technical_language>need for times(1). I default behavior</technical_language>

Target:
public void log_when_sonarqube_is_joining_a_cluster () throws IOException, InterruptedException, IllegalAccessException, NoSuchFieldException { TestAppSettings settings = newClusterSettings(); Logger logger = mock(Logger.class); AppStateClusterImpl.setLogger(logger); try (AppStateClusterImpl appStateCluster = new AppStateClusterImpl(settings)) { verify(logger).info( eq("Joined the cluster that contains the following hosts : [{}]"), eq("sonarqube"), anyString() ); } }
Source:
<code>private static Session getSession(EntityManager em) { Object delegate = em.getDelegate(); if ( delegate == null ) { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager (no delegate)" ); } else if ( Session.class.isAssignableFrom( delegate.getClass() ) ) { return (Session) delegate; } else if ( EntityManager.class.isAssignableFrom( delegate.getClass() ) ) { delegate = ( (EntityManager) delegate ).getDelegate(); if ( delegate == null ) { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager (no delegate)" ); } <START> else if ( Session.class.isAssignableFrom( delegate.getClass() ) ) { <END> return (Session) delegate; } else { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager: " + delegate.getClass() ); } } else { throw new SearchException( "Trying to use Hibernate Search without an Hibernate EntityManager: " + delegate.getClass() ); } }</code><technical_language>ah, moved code. Ok..</technical_language>

Target:
private static Session getSession(EntityManager em) { try { return em.unwrap( Session.class ); } catch (PersistenceException e) { throw new SearchException( "Trying to use Hibernate Search with a non-Hibernate EntityManager", e ); } }
Source:
<code>public void init(OverridableConf context, FunctionEval.ParamType types) { <START> if (!hasTimeZone()) { <END> setTimeZone(context.getConf().getSystemTimezone()); } }</code><technical_language>This function some bugs. default> \d test table name: default.test table uri: hdfs://localhost:7020/tajo/warehouse/default/test store type: TEXT number of rows: 1 volume: 40 B Options: 'timezone'='Asia/Seoul' 'text.delimiter'='|' schema: t TIME ts TIMESTAMP d DATE default> \set TIMEZONE GMT-9 default> select ts test; ts ------------------------------- 2015-04-30 21:01:23 2016-04-30 22:02:33 (2 rows, 0.016 sec, 0 B selected) default> select date_part('day', ts) test; ?date_part ------------------------------- 1.0 1.0 (2 rows, 0.021 sec, 0 B selected) default> select date_part('hour', ts) test; ?date_part ------------------------------- 15.0 16.0 (2 rows, 0.024 sec, 0 B selected)</technical_language>

Target:
public void init(OverridableConf context, FunctionEval.ParamType types) { setTimeZone(TimeZone.getTimeZone(context.get(SessionVars.TIMEZONE))); }
Source:
<code>default String getDefaultDialect() { <START> return "MYSQL"; <END> }</code><technical_language>of supported types</technical_language>

Target:
default String getDefaultDialect() { return "Hive"; }
Source:
<code>private void generateAddMethod(Method method) { Parameter mainParameter = method.getParameters().stream() .filter(x -> x.getType() instanceof StructType || x.getType() instanceof ListType) .findFirst() .orElse(null); if (mainParameter == null) { System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Response.class); javaBuffer.addImports(mainTypeReference.getImports()); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); javaBuffer.addLine(generateResponseReturnMethodSignature("add(%s %s)", mainTypeReference.getText(), <START> <END> javaNames.getJavaMemberStyleName(mainParameter.getName())) ); javaBuffer.addLine(); }</code><technical_language>4 spaces for indentation here? is style in rest of project</technical_language>

Target:
private void generateAddMethod(Method method) { Parameter mainParameter = method.getParameters().stream() .filter(x -> x.getType() instanceof StructType || x.getType() instanceof ListType) .findFirst() .orElse(null); if (mainParameter == null) { System.err.println("Method \"" + method + "\" doesn't have any struct parameter"); return; } Type mainType = mainParameter.getType(); JavaTypeReference mainTypeReference = schemaNames.getXjcTypeReference(mainType); javaBuffer.addImport(Consumes.class); javaBuffer.addImport(POST.class); javaBuffer.addImport(Response.class); javaBuffer.addImports(mainTypeReference.getImports()); generateDoc(method); javaBuffer.addLine("@POST"); javaBuffer.addLine("@Consumes({ %s })", generateMediaTypes()); generateResponseReturnMethod("add(%s %s)", mainTypeReference.getText(), javaNames.getJavaMemberStyleName(mainParameter.getName())); javaBuffer.addLine(); }
Source:
<code>public DynamicMBeanProvider register() throws JMException { Collection<DynamicMetric<?, ?>> dynamicMetrics = new HashSet<>(); _metricMap.values().forEach(metric -> dynamicMetrics.add(metric.getDynamicMetric())); String mbeanName = String.format("%s=%s, %s=%s", CLUSTER_NAME_KEY, _clusterName, ENTITY_NAME_KEY, _entityName); doRegister(dynamicMetrics, <START> new ObjectName(String.format("%s:%s", MonitorDomainNames.Rebalancer.name(), mbeanName))); <END> return this; }</code><technical_language>Question, is MetricCollector designed for Rebalancer metrics only? If not, is hardcoded</technical_language>

Target:
public DynamicMBeanProvider register() throws JMException { Collection<DynamicMetric<?, ?>> dynamicMetrics = new HashSet<>(); _metricMap.values().forEach(metric -> dynamicMetrics.add(metric.getDynamicMetric())); String mbeanName = String.format("%s=%s, %s=%s", CLUSTER_NAME_KEY, _clusterName, ENTITY_NAME_KEY, _entityName); doRegister(dynamicMetrics, new ObjectName(String.format("%s:%s", _monitorDomainName, mbeanName))); return this; }
Source:
<code>public Mono<RedisCache> updateResourceAsync() { updateParameters.withTags(this.inner().tags()); return this.manager().inner().getRedis().updateAsync(resourceGroupName(), name(), updateParameters) .map(innerToFluentMap(this)) .filter(redisCache -> !redisCache.provisioningState().equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .flatMap(redisCache -> { SdkContext.sleep(30 * 1000); this.patchScheduleAdded = false; <START> return this.manager().inner().getRedis().getByResourceGroupAsync(resourceGroupName(), name()) <END> .doOnNext( this::setInner) .filter(redisResourceInner -> redisResourceInner.provisioningState().toString() .equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .repeatWhenEmpty( longFlux -> longFlux.flatMap( index -> Mono.delay(SdkContext.getDelayDuration(Duration.ofSeconds(30))) ) ); } ) .then(this.patchSchedules.commitAndGetAllAsync()) .then(this.firewallRules.commitAndGetAllAsync()) .then(Mono.just(this)); }</code><technical_language>Another fake LRO</technical_language>

Target:
public Mono<RedisCache> updateResourceAsync() { updateParameters.withTags(this.inner().tags()); this.patchScheduleAdded = false; return this .manager() .inner() .getRedis() .updateAsync(resourceGroupName(), name(), updateParameters) .map(innerToFluentMap(this)) .filter( redisCache -> !redisCache.provisioningState().equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString())) .flatMapMany( redisCache -> Mono .delay(SdkContext.getDelayDuration(Duration.ofSeconds(30))) .flatMap(o -> manager().inner().getRedis().getByResourceGroupAsync(resourceGroupName(), name())) .doOnNext(this::setInner) .repeat() .takeUntil( redisResourceInner -> redisResourceInner .provisioningState() .toString() .equalsIgnoreCase(ProvisioningState.SUCCEEDED.toString()))) .then(this.patchSchedules.commitAndGetAllAsync()) .then(this.firewallRules.commitAndGetAllAsync()) .then(Mono.just(this)); }
Source:
<code>protected void openConnection() { if (!this.thing.getStatus().equals(ThingStatus.ONLINE)) { for (IpNode receiverNode : receiverNodes.keySet()) { Socket socket = receiverNodes.get(receiverNode); if (socket == null) { try { socket = new Socket(receiverNode.getAddressString(), receiverNode.getPort()); } catch (IOException e) { <START> logger.debug("Could not connect to in {}: ", receiverNode, this.thing.getUID(), e); <END> updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "could not connect to " + receiverNode.toString()); return; } } if (socket.isConnected()) { receiverNodes.put(receiverNode, socket); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); receiverNodes.put(receiverNode, null); return; } } updateStatus(ThingStatus.ONLINE); } }</code><technical_language>this is debug logging provide e.getMessage() instead re-add placeholder</technical_language>

Target:
protected void openConnection() { if (!this.thing.getStatus().equals(ThingStatus.ONLINE)) { for (IpNode receiverNode : receiverNodes.keySet()) { Socket socket = receiverNodes.get(receiverNode); if (socket == null) { try { socket = new Socket(receiverNode.getAddressString(), receiverNode.getPort()); } catch (IOException e) { logger.debug("Could not connect to in {}: {}", receiverNode, this.thing.getUID(), e.getMessage()); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, "could not connect to " + receiverNode.toString()); return; } } if (socket.isConnected()) { receiverNodes.put(receiverNode, socket); } else { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR); receiverNodes.put(receiverNode, null); return; } } updateStatus(ThingStatus.ONLINE); } }
Source:
<code>private void readFileData() throws IOException { final int version = parseInt(); if (version > VALID_GENTRAIN_DATA_TYPE) { throw new IOException("Error. Cannot read file - unknown version " + version + " for gentrain data type"); } manifestName = parseString(); numCodes = parseInt(); initializeArrays(numCodes); for (int i = 0; i < numCodes; i++) { <START> for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { <END> n[i][gtValue.ordinal()] = parseInt(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { devR[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { meanR[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { devTheta[i][gtValue.ordinal()] = parseFloat(); } for (InfiniumVcfFields.GENOTYPE_VALUES gtValue : InfiniumVcfFields.GENOTYPE_VALUES.values()) { meanTheta[i][gtValue.ordinal()] = parseFloat(); } skipFloats(15); } for (int i = 0; i < numCodes; i++) { skipFloat(); totalScore[i] = parseFloat(); skipFloat(); skipBoolean(); } for (int i = 0; i < numCodes; i++) { skipString(); } for (int i = 0; i < numCodes; i++) { rsNames[i] = parseString(); if (rsNameToIndex.put(rsNames[i], i) != null) { throw new PicardException("Non-unique rsName '" + rsNames[i] + "' found in cluster file"); } } }</code><technical_language>sense define functions parseInts parseFloats avoid this boilerplate</technical_language>

Target:
private void readFileData() throws IOException { final int version = parseInt(); if (version > VALID_GENTRAIN_DATA_TYPE) { throw new IOException("Error. Cannot read file - unknown version " + version + " for gentrain data type"); } manifestName = parseString(); numCodes = parseInt(); initializeArrays(numCodes); for (int i = 0; i < numCodes; i++) { parseInts(n[i]); parseFloats(devR[i]); parseFloats(meanR[i]); parseFloats(devTheta[i]); parseFloats(meanTheta[i]); skipFloats(15); } for (int i = 0; i < numCodes; i++) { skipFloat(); totalScore[i] = parseFloat(); skipFloat(); skipBoolean(); } for (int i = 0; i < numCodes; i++) { skipString(); } for (int i = 0; i < numCodes; i++) { rsNames[i] = parseString(); if (rsNameToIndex.put(rsNames[i], i) != null) { throw new PicardException("Non-unique rsName '" + rsNames[i] + "' found in cluster file"); } } }