auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public EngineSettings(ExtendedJSONObject object) throws NumberFormatException { this.syncID = object.getString("syncID"); <START> this.version = object.getIntegerSafely("version").intValue(); <END> }</code><technical_language>Careful. throw a ClassCastException in getString, a NullPointerException calling intValue result of getIntegerSafely. inclined wrap this thing: try { } catch (Exception e) { throw new IllegalArgumentException( ); // Rethrow cause. } a suitable "bad JSON" input. beats a random NPE if get a missing version</technical_language>

Target:
public EngineSettings(ExtendedJSONObject object) { try { this.syncID = object.getString("syncID"); this.version = object.getIntegerSafely("version").intValue(); } catch (Exception e ) { throw new IllegalArgumentException(e); } }
Source:
<code>public static void resetConnectionAfterTransaction(Connection con, @Nullable Integer previousIsolationLevel) { Assert.notNull(con, "No Connection specified"); <START> final boolean debugEnabled = logger.isDebugEnabled(); <END> try { if (previousIsolationLevel != null) { if (debugEnabled) { logger.debug("Resetting isolation level of JDBC Connection [" + con + "] to " + previousIsolationLevel); } con.setTransactionIsolation(previousIsolationLevel); } if (con.isReadOnly()) { if (logger.isDebugEnabled()) { logger.debug("Resetting read-only flag of JDBC Connection [" + con + "]"); } con.setReadOnly(false); } } catch (Throwable ex) { logger.debug("Could not reset JDBC Connection after transaction", ex); } }</code><technical_language>reason store in a local variable if method. suggestion</technical_language>

Target:
public static void resetConnectionAfterTransaction(Connection con, @Nullable Integer previousIsolationLevel) { Assert.notNull(con, "No Connection specified"); try { if (previousIsolationLevel != null) { if (logger.isDebugEnabled()) { logger.debug("Resetting isolation level of JDBC Connection [" + con + "] to " + previousIsolationLevel); } con.setTransactionIsolation(previousIsolationLevel); } if (con.isReadOnly()) { if (logger.isDebugEnabled()) { logger.debug("Resetting read-only flag of JDBC Connection [" + con + "]"); } con.setReadOnly(false); } } catch (Throwable ex) { logger.debug("Could not reset JDBC Connection after transaction", ex); } }
Source:
<code>public void return_mismatch_object_with_int32_values() { final int expected = 0; final int value1 = 1; <START> final int value2 = 2; <END> final ValueMismatch mismatch = Mismatch.of(expected, value1, value2, VERSION); final Int32Value expectedAny = fromAny(mismatch.getExpected()); final Int32Value actual = fromAny(mismatch.getActual()); final Int32Value requested = fromAny(mismatch.getRequested()); assertEquals(expected, expectedAny.getValue()); assertEquals(value1, actual.getValue()); assertEquals(value2, requested.getValue()); }</code><technical_language>Pls rename vars too</technical_language>

Target:
public void return_mismatch_object_with_int32_values() { final int expected = 0; final int actual = 1; final int requested = 2; final ValueMismatch mismatch = Mismatch.of(expected, actual, requested, VERSION); final Int32Value expectedWrapper = fromAny(mismatch.getExpected()); final Int32Value actualWrapper = fromAny(mismatch.getActual()); final Int32Value requestedWrapper = fromAny(mismatch.getRequested()); assertEquals(expected, expectedWrapper.getValue()); assertEquals(actual, actualWrapper.getValue()); assertEquals(requested, requestedWrapper.getValue()); }
Source:
<code>protected void fillImageParameters(final PDDocument doc, final SignatureImageParameters signatureImageParameters, SignatureOptions options) throws IOException { if(signatureImageParameters != null) { ImageAndResolution ires = ImageUtils.create(signatureImageParameters); InputStream is = ires.getInputStream(); try { PDVisibleSignDesigner visibleSig = new PDVisibleSignDesigner(doc, is, signatureImageParameters.getPage()); visibleSig.xAxis(signatureImageParameters.getxAxis()); visibleSig.yAxis(signatureImageParameters.getyAxis()); <START> if(signatureImageParameters.getWidth()== 0 && signatureImageParameters.getHeight()== 0){ <END> visibleSig.width(signatureImageParameters.getWidth()); visibleSig.height(signatureImageParameters.getHeight()); } else { visibleSig.width(ires.toXPoint(visibleSig.getWidth())); visibleSig.height(ires.toYPoint(visibleSig.getHeight())); } LOG.info("Width: " + visibleSig.getWidth() + " Height: "+ visibleSig.getHeight()); visibleSig.zoom(signatureImageParameters.getZoom() - 100); PDVisibleSigProperties signatureProperties = new PDVisibleSigProperties(); signatureProperties.visualSignEnabled(true).setPdVisibleSignature(visibleSig).buildSignature(); options.setVisualSignature(signatureProperties); options.setPage(signatureImageParameters.getPage() - 1); } finally { Utils.closeQuietly(is); } } }</code><technical_language>Sebastian, ? If values set, update properties in visibleSig. BR, Pierrick</technical_language>

Target:
protected void fillImageParameters(final PDDocument doc, final SignatureImageParameters signatureImageParameters, SignatureOptions options) throws IOException { if(signatureImageParameters != null) { ImageAndResolution ires = ImageUtils.create(signatureImageParameters); InputStream is = ires.getInputStream(); try { PDVisibleSignDesigner visibleSig = new PDVisibleSignDesigner(doc, is, signatureImageParameters.getPage()); visibleSig.xAxis(signatureImageParameters.getxAxis()); visibleSig.yAxis(signatureImageParameters.getyAxis()); if(signatureImageParameters.getWidth()!= 0 && signatureImageParameters.getHeight()!= 0){ visibleSig.width(signatureImageParameters.getWidth()); visibleSig.height(signatureImageParameters.getHeight()); } else { visibleSig.width(ires.toXPoint(visibleSig.getWidth())); visibleSig.height(ires.toYPoint(visibleSig.getHeight())); } LOG.info("Width: " + visibleSig.getWidth() + " Height: "+ visibleSig.getHeight()); visibleSig.zoom(signatureImageParameters.getZoom() - 100); PDVisibleSigProperties signatureProperties = new PDVisibleSigProperties(); signatureProperties.visualSignEnabled(true).setPdVisibleSignature(visibleSig).buildSignature(); options.setVisualSignature(signatureProperties); options.setPage(signatureImageParameters.getPage() - 1); } finally { Utils.closeQuietly(is); } } }
Source:
<code>public void testThreadNameWithoutNumberNoDemon() { <START> Assert.assertEquals(ThreadUtils.createThreadFactory(THREAD_NAME, false). <END> newThread(EMPTY_RUNNABLE).getName(), THREAD_NAME); }</code><technical_language>In assert method, argument is "expected" while is "actual" value. swap in this file match definition</technical_language>

Target:
public void testThreadNameWithoutNumberNoDemon() { assertEquals(THREAD_NAME, ThreadUtils.createThreadFactory(THREAD_NAME, false). newThread(EMPTY_RUNNABLE).getName()); }
Source:
<code>public void clear() { <START> cleared = true; <END> }</code><technical_language>if I add some operations, clear, end results is clear map apply operations, get expected results. I.e.: map.put() map.clear() give result map.clear() this clear() method need a "currentState.clear(); " ? This affect isEmpty() calculation</technical_language>

Target:
public void clear() { cleared = true; currentState.clear(); }
Source:
<code>public Map<String, Object> getReturnValues() { Result result = new Result(); return result.toMap(); <START> } <END></code><technical_language>This is correct. Component definition declares component provides RETURN_TOTAL_RECORD_COUNT_PROP, computes this</technical_language>

Target:
public Map<String, Object> getReturnValues() { Result result = new Result(); result.totalCount = recordCount; return result.toMap(); }
Source:
<code>public Set<Usermetadata> getUserMetadataByUser(String username, UserMetadataTypeEnum userMetadataTypeEnum) throws UserNotFoundException { <START> User user = userSrv.findUserByLogin(username); assert user != null; <END> Set<Usermetadata> umSet = new HashSet<>(); for (Group group : user.getGroups()) { List<GroupUsermetadata> guList = groupUsermetadataRepo.findByGroup(group); for (GroupUsermetadata gu : guList) { Usermetadata u = gu.getUsermetadata(); if (u.getUsermetadataType().getId().equals(userMetadataTypeEnum.getUserMetadataTypeId()) && u.getIsValid()) { umSet.add(u); } } } return umSet; }</code><technical_language>This line is redundant findUserByLogin throw a UserNotFoundException: assert user != null;</technical_language>

Target:
public Set<Usermetadata> getUserMetadataByUser(String username, UserMetadataTypeEnum userMetadataTypeEnum) throws UserNotFoundException { User user = userSrv.findUserByLogin(username); Set<Usermetadata> umSet = new HashSet<>(); for (Group group : user.getGroups()) { List<GroupUsermetadata> guList = groupUsermetadataRepo.findByGroup(group); for (GroupUsermetadata gu : guList) { Usermetadata u = gu.getUsermetadata(); if (u.getUsermetadataType().getId().equals(userMetadataTypeEnum.getUserMetadataTypeId()) && u.getIsValid()) { umSet.add(u); } } } return umSet; }
Source:
<code>public Set<Encoding> extract(Iterable<Availability> availabilities) { ImmutableSet.Builder<Encoding> encodings = ImmutableSet.builder(); for (Availability availability : availabilities) { Set<Location> locations = getLocationsFor(availability); if (!locations.isEmpty()) { Encoding encoding = new Encoding(); encoding.setAvailableAt(locations); setHorizontalAndVerticalSize(encoding, IS_HD.apply(availability)); <START> encoding.setVideoBitRate(IS_HD.apply(availability) ? HD_BITRATE: SD_BITRATE); <END> encodings.add(encoding); } } return encodings.build(); }</code><technical_language>this apply for non-YV media sets? e.g. iptv-all</technical_language>

Target:
public Set<Encoding> extract(Iterable<Availability> availabilities) { ImmutableSet.Builder<Encoding> encodings = ImmutableSet.builder(); for (Availability availability : availabilities) { Set<Location> locations = getLocationsFor(availability); if (!locations.isEmpty()) { Encoding encoding = new Encoding(); encoding.setAvailableAt(locations); if (IS_IPTV.apply(availability)) { setHorizontalAndVerticalSize(encoding, IS_HD.apply(availability)); encoding.setVideoBitRate(IS_HD.apply(availability) ? HD_BITRATE : SD_BITRATE); } encodings.add(encoding); } } return encodings.build(); }
Source:
<code>public static Resources getResourcesForSubId(Context context, int subId, boolean useRootLocale) { Pair<Context, Integer> cacheKey = null; if (isValidSubscriptionId(subId) && !useRootLocale) { cacheKey = Pair.create(context, subId); if (sResourcesCache.containsKey(cacheKey)) { return sResourcesCache.get(cacheKey); } } final SubscriptionInfo subInfo = SubscriptionManager.from(context).getActiveSubscriptionInfo(subId); Configuration config = context.getResources().getConfiguration(); <START> Configuration newConfig = new Configuration(); <END> newConfig.setTo(config); if (subInfo != null) { newConfig.mcc = subInfo.getMcc(); newConfig.mnc = subInfo.getMnc(); if (newConfig.mnc == 0) newConfig.mnc = Configuration.MNC_ZERO; } if (useRootLocale) { newConfig.setLocale(Locale.ROOT); } Context newContext = context.createConfigurationContext(newConfig); Resources res = newContext.getResources(); if (cacheKey != null) { sResourcesCache.put(cacheKey, res); } return res; }</code><technical_language>overrideConfig</technical_language>

Target:
public static Resources getResourcesForSubId(Context context, int subId, boolean useRootLocale) { Pair<Context, Integer> cacheKey = null; if (isValidSubscriptionId(subId) && !useRootLocale) { cacheKey = Pair.create(context, subId); if (sResourcesCache.containsKey(cacheKey)) { return sResourcesCache.get(cacheKey); } } final SubscriptionInfo subInfo = SubscriptionManager.from(context).getActiveSubscriptionInfo(subId); Configuration overrideConfig = new Configuration(); if (subInfo != null) { overrideConfig.mcc = subInfo.getMcc(); overrideConfig.mnc = subInfo.getMnc(); if (overrideConfig.mnc == 0) overrideConfig.mnc = Configuration.MNC_ZERO; } if (useRootLocale) { overrideConfig.setLocale(Locale.ROOT); } Context newContext = context.createConfigurationContext(overrideConfig); Resources res = newContext.getResources(); if (cacheKey != null) { sResourcesCache.put(cacheKey, res); } return res; }
Source:
<code>public void doTable(Parse table) { initialiseDataTables(); Parse lastRow = table.parts.more; if (lastRow == null) { throw new Error("Query structure missing from second row"); } loadRowStructure(lastRow); lastRow = processDataTable(dt1, dt2, lastRow, symbol2); List<DataRow> unproc = dt2.getUnprocessedRows(); for (DataRow dr : unproc) { Parse errorRow = parseDataRowAsError(dr, " missing from " + symbol1); <START> lastRow.more = errorRow; <END> } }</code><technical_language>@javornikolov I understand test. rows exists in query 2 in query 1, marked error (missing) chained one, is chained rows processed. > I here? Sorry. I I other around. testing 1 missing row, 3 missing: !|Execute|create table TESTTBL (N int, TWON int)| !|Insert|TESTTBL| |N |TWON | |1 |2 | |2 |4 | |3 |6 | |4 |8 | |5 |10 | !|Store Query|select * TESTTBL|q1| !|Store Query|select * TESTTBL n in (1, 2)|q2| !|Compare Stored Queries|q2|q1| |N |TWON?| !|Execute|drop table TESTTBL|</technical_language>

Target:
public void doTable(Parse table) { initialiseDataTables(); Parse lastRow = table.parts.more; if (lastRow == null) { throw new Error("Query structure missing from second row"); } loadRowStructure(lastRow); lastRow = processDataTable(dt1, dt2, lastRow, symbol2); List<DataRow> unproc = dt2.getUnprocessedRows(); for (DataRow dr : unproc) { Parse errorRow = parseDataRowAsError(dr, " missing from " + symbol1); lastRow.more = errorRow; lastRow = errorRow; } }
Source:
<code>public static PmProxyType fromValue(String v) { try { if (v==null) { return null; } if (v.equals("cluster")) { return CLUSTER; } else if (v.equals("dc")) { return DC; } else { <START> return valueOf(v.toUpperCase()); <END> } } catch (IllegalArgumentException e) { return null; } }</code><technical_language>if 'v' is a member of enum return in upper case</technical_language>

Target:
public static PmProxyType fromValue(String v) { try { if (v==null) { return null; } if (v.equals("cluster")) { return CLUSTER; } else if (v.equals("dc")) { return DC; } else { return null; } } catch (IllegalArgumentException e) { return null; } }
Source:
<code>public void setup() { this.context = new MockContext(); <START> this.jobContextMetadata = new JobContextMetadata(null, null); <END> when(this.context.getTaskContext().getTaskMetricsRegistry()).thenReturn(new MetricsRegistryMap()); when(this.context.getTaskContext().getTaskModel()).thenReturn(mock(TaskModel.class)); when(this.context.getContainerContext().getContainerMetricsRegistry()).thenReturn(new MetricsRegistryMap()); }</code><technical_language>Consider mocking this object Mockito instead of a real instance. test a bit more resilient changes JobContextMetadata in future</technical_language>

Target:
public void setup() { this.context = new MockContext(); this.internalTaskContext = mock(InternalTaskContext.class); when(this.internalTaskContext.getContext()).thenReturn(this.context); when(this.internalTaskContext.fetchObject(EndOfStreamStates.class.getName())).thenReturn(mock(EndOfStreamStates.class)); when(this.internalTaskContext.fetchObject(WatermarkStates.class.getName())).thenReturn(mock(WatermarkStates.class)); when(this.context.getTaskContext().getTaskMetricsRegistry()).thenReturn(new MetricsRegistryMap()); when(this.context.getTaskContext().getTaskModel()).thenReturn(mock(TaskModel.class)); when(this.context.getContainerContext().getContainerMetricsRegistry()).thenReturn(new MetricsRegistryMap()); }
Source:
<code>public ChromeDriver(ChromeDriverService service, Capabilities capabilities) { super(new ChromeDriverCommandExecutor(service), capabilities); if (capabilities.getCapability("enableDownloading")!=null){ sendCommandForDownloadChromeHeadLess( <START> (String) capabilities.getCapability("enableDownloading")); <END> } locationContext = new RemoteLocationContext(getExecuteMethod()); webStorage = new RemoteWebStorage(getExecuteMethod()); touchScreen = new RemoteTouchScreen(getExecuteMethod()); networkConnection = new RemoteNetworkConnection(getExecuteMethod()); }</code><technical_language>get a ClassCastException here. ways avoid this: check capabilities.getCapability("enableDownloading") instanceof String, String.valueOf here</technical_language>

Target:
public ChromeDriver(ChromeDriverService service, Capabilities capabilities) { super(new ChromeDriverCommandExecutor(service), capabilities); if (capabilities.getCapability("chromium:enableDownloadTo") instanceof String) { sendCommandForDownloadChromeHeadless( (String) capabilities.getCapability("chromium:enableDownloadTo")); } locationContext = new RemoteLocationContext(getExecuteMethod()); webStorage = new RemoteWebStorage(getExecuteMethod()); touchScreen = new RemoteTouchScreen(getExecuteMethod()); networkConnection = new RemoteNetworkConnection(getExecuteMethod()); }
Source:
<code>public TokenFactory tokenFactoryFor(String partitioner) { <START> if (partitioner.endsWith("Murmur3Partitioner")) { <END> LOG.debug("[{}] Detected Murmur3 partitioner ({})", logPrefix, partitioner); return new Murmur3TokenFactory(partitioner); } else if (partitioner.endsWith("RandomPartitioner")) { LOG.debug("[{}] Detected random partitioner ({})", logPrefix, partitioner); return new RandomTokenFactory(partitioner); } else if (partitioner.endsWith("OrderedPartitioner")) { LOG.debug("[{}] Detected byte ordered partitioner ({})", logPrefix, partitioner); return new ByteOrderedTokenFactory(partitioner); } else { LOG.warn( "[{}] Unsupported partitioner '{}', token map will be empty.", logPrefix, partitioner); return null; } }</code><technical_language>Is realistic imagine a Murmur3 partitioner exist other org.apache.cassandra.dht.Murmur3Partitioner? so, error out in case instead of assume partitioner? I if simply store FQCN of partitioner a public constant field in TokenFactory implementation reference equals instead of endsWith</technical_language>

Target:
public TokenFactory tokenFactoryFor(String partitioner) { if (Murmur3TokenFactory.PARTITIONER_NAME.equals(partitioner)) { LOG.debug("[{}] Detected Murmur3 partitioner ({})", logPrefix, partitioner); return new Murmur3TokenFactory(); } else if (RandomTokenFactory.PARTITIONER_NAME.equals(partitioner)) { LOG.debug("[{}] Detected random partitioner ({})", logPrefix, partitioner); return new RandomTokenFactory(); } else if (ByteOrderedTokenFactory.PARTITIONER_NAME.equals(partitioner)) { LOG.debug("[{}] Detected byte ordered partitioner ({})", logPrefix, partitioner); return new ByteOrderedTokenFactory(); } else { LOG.warn( "[{}] Unsupported partitioner '{}', token map will be empty.", logPrefix, partitioner); return null; } }
Source:
<code>public URIish(String s) throws URISyntaxException { if (StringUtils.isEmptyOrNull(s)) { throw new URISyntaxException("The uri was empty or null", JGitText.get().cannotParseGitURIish); } Matcher matcher = SINGLE_SLASH_FILE_URI.matcher(s); if (matcher.matches()) { scheme = matcher.group(1); path = cleanLeadingSlashes(unescape(matcher.group(2)), scheme); return; } matcher = FULL_URI.matcher(s); if (matcher.matches()) { scheme = matcher.group(1); user = unescape(matcher.group(2)); pass = unescape(matcher.group(3)); host = unescape(matcher.group(4)); if (matcher.group(5) != null) port = Integer.parseInt(matcher.group(5)); <START> path = cleanLeadingSlashes(unescape(n2e(matcher.group(6)) <END> + n2e(matcher.group(7))), scheme); return; } matcher = RELATIVE_SCP_URI.matcher(s); if (matcher.matches()) { user = unescape(matcher.group(1)); pass = unescape(matcher.group(2)); host = unescape(matcher.group(3)); path = unescape(matcher.group(4)); return; } matcher = ABSOLUTE_SCP_URI.matcher(s); if (matcher.matches()) { user = matcher.group(1); pass = matcher.group(2); host = matcher.group(3); path = matcher.group(4); return; } matcher = LOCAL_FILE.matcher(s); if (matcher.matches()) { path = matcher.group(1); return; } throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish); }</code><technical_language>C Git support escaping path in a ssh:// git+ssh:// ssh+git:// style URIish? in HTTP style URIish, re-escape pass URI remote HTTP server. bothering unescape here</technical_language>

Target:
public URIish(String s) throws URISyntaxException { if (StringUtils.isEmptyOrNull(s)) { throw new URISyntaxException("The uri was empty or null", JGitText.get().cannotParseGitURIish); } Matcher matcher = SINGLE_SLASH_FILE_URI.matcher(s); if (matcher.matches()) { scheme = matcher.group(1); path = cleanLeadingSlashes(unescape(matcher.group(2)), scheme); return; } matcher = FULL_URI.matcher(s); if (matcher.matches()) { scheme = matcher.group(1); user = unescape(matcher.group(2)); pass = unescape(matcher.group(3)); host = unescape(matcher.group(4)); if (matcher.group(5) != null) port = Integer.parseInt(matcher.group(5)); path = cleanLeadingSlashes(unescape(n2e(matcher.group(6)) + n2e(matcher.group(7))), scheme); return; } matcher = RELATIVE_SCP_URI.matcher(s); if (matcher.matches()) { user = matcher.group(1); pass = matcher.group(2); host = matcher.group(3); path = matcher.group(4); return; } matcher = ABSOLUTE_SCP_URI.matcher(s); if (matcher.matches()) { user = matcher.group(1); pass = matcher.group(2); host = matcher.group(3); path = matcher.group(4); return; } matcher = LOCAL_FILE.matcher(s); if (matcher.matches()) { path = matcher.group(1); return; } throw new URISyntaxException(s, JGitText.get().cannotParseGitURIish); }
Source:
<code>private Cursor makeCardsTypesCursor() { String query = "select " + "sum(case when queue=2 and ivl >= 21 then 1 else 0 end), -- mtr\n" + "sum(case when queue in (1,3) or (queue=2 and ivl < 21) then 1 else 0 end), -- yng/lrn\n" + "sum(case when queue=0 then 1 else 0 end), -- new\n" + "sum(case when queue<0 then 1 else 0 end) -- susp\n" + "from cards"; <START> <END> return mCollection.getDb() .getDatabase() .rawQuery(query, null); }</code><technical_language>constants embedded in strings extracted class constants if defined in other objects references existing definitions</technical_language>

Target:
private Cursor makeCardsTypesCursor() { SQLiteDatabase db = getDbOrNull(); if (db == null) { initCollection(); db = getDbOrNull(); } if (db == null) { return null; } return Stats.getCardTypesStats(db); }
Source:
<code>private void handleInvalidRefreshToken(TokenResponse tokenResponse) { final TokenErrorResponseType errorType = tokenResponse.getErrorType(); final ErrorResponseCode errorCode; if (errorType == INVALID_GRANT) { errorCode = INVALID_REFRESH_TOKEN; } else { errorCode = INTERNAL_ERROR_NO_PARAMS; } <START> throw new HttpException(errorCode); <END> }</code><technical_language>right exiting method please log actual errorType result errorCode, send log file exact mapping. obvious time changed, obvious</technical_language>

Target:
private void handleInvalidRefreshToken(TokenResponse tokenResponse) { final TokenErrorResponseType errorType = tokenResponse.getErrorType(); final ErrorResponseCode errorCode; if (errorType == INVALID_GRANT) { errorCode = INVALID_REFRESH_TOKEN; } else { errorCode = INTERNAL_ERROR_NO_PARAMS; } LOG.error(errorCode.getDescription()); throw new HttpException(errorCode); }
Source:
<code>public boolean select(Viewer viewer, Object parent, Object element) { <START> IBreakpoint breakpoint = (IBreakpoint) element; <END> IInteractionElement interactionElement = ContextCore.getContextManager().getElement( structureBridge.getHandleIdentifier(breakpoint)); if (interactionElement == null) { return true; } return !interactionElement.getInterest().isInteresting(); }</code><technical_language>instanceof check good in case other items added view in future</technical_language>

Target:
public boolean select(Viewer viewer, Object parent, Object element) { if (element instanceof IBreakpoint) { IBreakpoint breakpoint = (IBreakpoint) element; IInteractionElement interactionElement = ContextCore.getContextManager().getElement( structureBridge.getHandleIdentifier(breakpoint)); if (interactionElement == null) { return true; } return !interactionElement.getInterest().isInteresting(); } return true; }
Source:
<code>public void validate_shouldFailForAConceptIfThereIsNotAtLeastOneNonBlankDescription() throws Exception { Concept concept = new Concept(); concept.addDescription(new ConceptDescription(null)); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); <START> Assert.assertEquals(true, errors.hasErrors()); <END> }</code><technical_language>other validation errors enough test if any, need for loop test a code "Concept.error.notAtLeast..."</technical_language>

Target:
public void validate_shouldFailForAConceptIfThereIsNotAtLeastOneNonBlankDescription() throws Exception { Concept concept = new Concept(); concept.addDescription(new ConceptDescription(null)); concept.addDescription(new ConceptDescription("", Context.getLocale())); Errors errors = new BindException(concept, "concept"); new ConceptValidator().validate(concept, errors); boolean found = false; for (ObjectError error : errors.getAllErrors()) { if (error.getCode().equals("Concept.error.notAtLeastOneNonBlankDescription")) { found = true; break; } } Assert.assertTrue(found); }
Source:
<code>private CompositeBlobInfo deserializeMetadataContentV3(ByteBuffer metadataContent, StoreKeyFactory storeKeyFactory) <START> throws MessageFormatException, IOException { <END> ByteBufferInputStream byteBufferInputStream = new ByteBufferInputStream(metadataContent); DataInputStream inputStream = new DataInputStream(byteBufferInputStream); short metadataContentVersion = inputStream.readShort(); Assert.assertEquals("Metadata Content Version mismatch ", MessageFormatRecord.Metadata_Content_Version_V3, metadataContentVersion); return MessageFormatRecord.Metadata_Content_Format_V3.deserializeMetadataContentRecord(inputStream, storeKeyFactory); }</code><technical_language>MessageFormatException thrown this method</technical_language>

Target:
private CompositeBlobInfo deserializeMetadataContentV3(ByteBuffer metadataContent, StoreKeyFactory storeKeyFactory) throws IOException { ByteBufferInputStream byteBufferInputStream = new ByteBufferInputStream(metadataContent); DataInputStream inputStream = new DataInputStream(byteBufferInputStream); short metadataContentVersion = inputStream.readShort(); Assert.assertEquals("Metadata Content Version mismatch ", MessageFormatRecord.Metadata_Content_Version_V3, metadataContentVersion); return MessageFormatRecord.Metadata_Content_Format_V3.deserializeMetadataContentRecord(inputStream, storeKeyFactory); }
Source:
<code>public void setCheckAllLedgersCTime(long checkAllLedgersCTime) throws UnavailableException { <START> LOG.debug("setCheckAllLedgersCTime"); <END> try { if (zkc.exists(checkAllLedgersCtimeZnode, false) != null) { zkc.setData(checkAllLedgersCtimeZnode, Long.toString(checkAllLedgersCTime).getBytes(UTF_8), -1); } else { zkc.create(checkAllLedgersCtimeZnode, Long.toString(checkAllLedgersCTime).getBytes(UTF_8), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); } } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } }</code><technical_language>add if (LOG.isDebugEnabled())</technical_language>

Target:
public void setCheckAllLedgersCTime(long checkAllLedgersCTime) throws UnavailableException { if (LOG.isDebugEnabled()) { LOG.debug("setCheckAllLedgersCTime"); } try { List<ACL> zkAcls = ZkUtils.getACLs(conf); CheckAllLedgersFormat.Builder builder = CheckAllLedgersFormat.newBuilder(); builder.setCheckAllLedgersCTime(checkAllLedgersCTime); byte[] checkAllLedgersFormatByteArray = builder.build().toByteArray(); if (zkc.exists(checkAllLedgersCtimeZnode, false) != null) { zkc.setData(checkAllLedgersCtimeZnode, checkAllLedgersFormatByteArray, -1); } else { zkc.create(checkAllLedgersCtimeZnode, checkAllLedgersFormatByteArray, zkAcls, CreateMode.PERSISTENT); } } catch (KeeperException ke) { throw new ReplicationException.UnavailableException("Error contacting zookeeper", ke); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); throw new ReplicationException.UnavailableException("Interrupted while contacting zookeeper", ie); } }
Source:
<code>private byte[] internalWrite(final int major) throws IOException { try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { ITF8.writeUnsignedITF8(sequenceId, outputStream); ITF8.writeUnsignedITF8(alignmentStart, outputStream); ITF8.writeUnsignedITF8(alignmentSpan, outputStream); ITF8.writeUnsignedITF8(recordCount, outputStream); LTF8.writeUnsignedLTF8(globalRecordCounter, outputStream); ITF8.writeUnsignedITF8(dataBlockCount, outputStream); CramIntArray.write(contentIDs, outputStream); ITF8.writeUnsignedITF8(embeddedRefBlockContentID, outputStream); <START> outputStream.write(refMD5 == null ? NO_MD5 : refMD5); <END> if (major >= CramVersions.CRAM_v3.major && tags != null) { final BinaryCodec binaryCoded = new BinaryCodec(outputStream); final BinaryTagCodec binaryTagCodec = new BinaryTagCodec(binaryCoded); SAMBinaryTagAndValue samBinaryTagAndValue = tags; do { log.debug("Writing slice tag: " + SAMTag.makeStringTag(samBinaryTagAndValue.tag)); binaryTagCodec.writeTag(samBinaryTagAndValue.tag, samBinaryTagAndValue.value, samBinaryTagAndValue.isUnsignedArray()); } while ((samBinaryTagAndValue = samBinaryTagAndValue.getNext()) != null); } return outputStream.toByteArray(); } }</code><technical_language>Is NO_MD5 supposed a ? written out set. relying zeros</technical_language>

Target:
private byte[] internalWrite(final int major) throws IOException { try (final ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { ITF8.writeUnsignedITF8(sequenceId, outputStream); ITF8.writeUnsignedITF8(sliceAlignment.getStart(), outputStream); ITF8.writeUnsignedITF8(sliceAlignment.getSpan(), outputStream); ITF8.writeUnsignedITF8(sliceAlignment.getCount(), outputStream); LTF8.writeUnsignedLTF8(globalRecordCounter, outputStream); ITF8.writeUnsignedITF8(dataBlockCount, outputStream); CramIntArray.write(contentIDs, outputStream); ITF8.writeUnsignedITF8(embeddedRefBlockContentID, outputStream); outputStream.write(refMD5 == null ? NO_MD5 : refMD5); if (major >= CramVersions.CRAM_v3.major && sliceHeaderTags != null) { try (final BinaryCodec codec = new BinaryCodec(outputStream)) { final BinaryTagCodec binaryTagCodec = new BinaryTagCodec(codec); SAMBinaryTagAndValue samBinaryTagAndValue = sliceHeaderTags; do { log.debug("Writing slice tag: " + SAMTag.makeStringTag(samBinaryTagAndValue.tag)); binaryTagCodec.writeTag(samBinaryTagAndValue.tag, samBinaryTagAndValue.value, samBinaryTagAndValue.isUnsignedArray()); } while ((samBinaryTagAndValue = samBinaryTagAndValue.getNext()) != null); } } return outputStream.toByteArray(); } }
Source:
<code>public void should_skip_invalid_peers_row_v2(String columnToCheck) { topologyMonitor.isSchemaV2 = true; node2.broadcastAddress = ADDRESS2; AdminRow peer2 = mockPeersV2Row(2, node2.getHostId()); switch (columnToCheck) { case "native_address": when(peer2.getInetAddress(columnToCheck)).thenReturn(null); break; case "native_port": when(peer2.getInteger(columnToCheck)).thenReturn(null); break; case "host_id": when(peer2.getUuid(columnToCheck)).thenReturn(null); break; case "data_center": <START> when(peer2.getUuid(columnToCheck)).thenReturn(null); <END> break; } topologyMonitor.stubQueries( new StubbedQuery( "SELECT * FROM system.peers_v2 WHERE peer = :address and peer_port = :port", ImmutableMap.of("address", ADDRESS2.getAddress(), "port", 9042), mockResult(peer2))); CompletionStage<Optional<NodeInfo>> futureInfo = topologyMonitor.refreshNode(node2); assertThatStage(futureInfo).isSuccess(maybeInfo -> assertThat(maybeInfo).isEmpty()); assertThat(node2.broadcastAddress).isNotNull().isEqualTo(ADDRESS2); assertLog( Level.WARN, "[null] Found invalid row in system.peers_v2 for peer: /127.0.0.2. " + "This is likely a gossip or snitch issue, this node will be ignored."); }</code><technical_language>This when(peer2.getDatacenter(columnToCheck)).thenReturn(null); EDIT sorry: when(peer2.getString(columnToCheck)).thenReturn(null);</technical_language>

Target:
public void should_skip_invalid_peers_row_v2(String columnToCheck) { topologyMonitor.isSchemaV2 = true; node2.broadcastAddress = ADDRESS2; AdminRow peer2 = mockPeersV2Row(2, node2.getHostId()); when(peer2.isNull(columnToCheck)).thenReturn(true); topologyMonitor.stubQueries( new StubbedQuery( "SELECT * FROM system.peers_v2 WHERE peer = :address and peer_port = :port", ImmutableMap.of("address", ADDRESS2.getAddress(), "port", 9042), mockResult(peer2))); CompletionStage<Optional<NodeInfo>> futureInfo = topologyMonitor.refreshNode(node2); assertThatStage(futureInfo).isSuccess(maybeInfo -> assertThat(maybeInfo).isEmpty()); assertThat(node2.broadcastAddress).isNotNull().isEqualTo(ADDRESS2); assertLog( Level.WARN, "[null] Found invalid row in system.peers_v2 for peer: /127.0.0.2. " + "This is likely a gossip or snitch issue, this node will be ignored."); }
Source:
<code>public void stepExecutionWithCredentials() throws Exception { assumeNotWindows(); IdCredentials registryCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "registryCreds", null, "me", "pass"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), registryCredentials); WorkflowJob p = r.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " mockDockerLoginWithEcho {\n" + " withDockerRegistry(url: 'https://my-reg:1234', credentialsId: 'registryCreds') {\n" + <START> " echo 'config would be set up to connect to https://my-reg:1234'\n" + <END> " }\n" + " }\n" + "}", true)); WorkflowRun b = r.buildAndAssertSuccess(p); r.assertLogContains("docker login -u me -p pass https://my-reg:1234", r.assertBuildStatusSuccess(r.waitForCompletion(b))); r.assertLogContains("config would be set up to connect to https://my-reg:1234", b); }</code><technical_language>I this is proving. print a literal message, assert identical message printed</technical_language>

Target:
public void stepExecutionWithCredentials() throws Exception { assumeNotWindows(); IdCredentials registryCredentials = new UsernamePasswordCredentialsImpl(CredentialsScope.GLOBAL, "registryCreds", null, "me", "pass"); CredentialsProvider.lookupStores(r.jenkins).iterator().next().addCredentials(Domain.global(), registryCredentials); WorkflowJob p = r.createProject(WorkflowJob.class, "prj"); p.setDefinition(new CpsFlowDefinition( "node {\n" + " mockDockerLoginWithEcho {\n" + " withDockerRegistry(url: 'https://my-reg:1234', credentialsId: 'registryCreds') {\n" + " }\n" + " }\n" + "}", true)); WorkflowRun b = r.buildAndAssertSuccess(p); r.assertLogContains("docker login -u me -p pass https://my-reg:1234", r.assertBuildStatusSuccess(r.waitForCompletion(b))); }
Source:
<code>public List<RebaseTodoLine> readRebaseTodo(String path, boolean includeComments) throws IOException { byte[] buf = IO.readFully(new File(repo.getDirectory(), path)); int ptr = 0; int tokenBegin = 0; List<RebaseTodoLine> r = new LinkedList<RebaseTodoLine>(); while (ptr < buf.length) { tokenBegin = ptr; ptr = RawParseUtils.nextLF(buf, ptr); int lineStart = tokenBegin; int lineEnd = ptr - 2; if (lineEnd >= 0 && buf[lineEnd] == '\r') lineEnd--; if (buf[tokenBegin] == '#') { <START> if (includeComments) { <END> RebaseTodoLine line = null; String commentString = RawParseUtils.decode(buf, tokenBegin, lineEnd + 1); try { int skip = tokenBegin + 1; skip = nextParsableToken(buf, skip, lineEnd); if (skip != -1) { line = parseLine(buf, skip, lineEnd); line.setAction(Action.COMMENT); line.setComment(commentString); } } catch (Exception e) { line = null; } finally { if (line == null) line = new RebaseTodoLine(commentString); r.add(line); } } continue; } tokenBegin = nextParsableToken(buf, tokenBegin, lineEnd); if (tokenBegin == -1) { if (includeComments) r.add(new RebaseTodoLine(RawParseUtils.decode(buf, lineStart, 1 + lineEnd))); continue; } RebaseTodoLine line = parseLine(buf, tokenBegin, lineEnd); if (line == null) continue; r.add(line); } return r; }</code><technical_language>extract a method for</technical_language>

Target:
public List<RebaseTodoLine> readRebaseTodo(String path, boolean includeComments) throws IOException { byte[] buf = IO.readFully(new File(repo.getDirectory(), path)); int ptr = 0; int tokenBegin = 0; List<RebaseTodoLine> r = new LinkedList<RebaseTodoLine>(); while (ptr < buf.length) { tokenBegin = ptr; ptr = RawParseUtils.nextLF(buf, ptr); int lineStart = tokenBegin; int lineEnd = ptr - 2; if (lineEnd >= 0 && buf[lineEnd] == '\r') lineEnd--; if (buf[tokenBegin] == '#') { if (includeComments) { parseComments(buf, tokenBegin, r, lineEnd); } } else { tokenBegin = nextParsableToken(buf, tokenBegin, lineEnd); if (tokenBegin == -1) { if (includeComments) r.add(new RebaseTodoLine(RawParseUtils.decode(buf, lineStart, 1 + lineEnd))); continue; } RebaseTodoLine line = parseLine(buf, tokenBegin, lineEnd); if (line == null) continue; r.add(line); } } return r; }
Source:
<code>private boolean calculateMaxOffset(int size) { <START> if (size + Bytes.SIZEOF_INT + 2 <= Short.MAX_VALUE) { <END> return true; } return false; }</code><technical_language>represent 2 \* Short.MAX_VALUE subtracting Short.MAX_VALUE for offset adding reading</technical_language>

Target:
private boolean calculateMaxOffset(int size) { if ((size + Bytes.SIZEOF_INT + MAX_POSSIBLE_VINT_LENGTH) <= (2 * Short.MAX_VALUE)) { return true; } return false; }
Source:
<code>public SearchMapping getSearchMapping() { SearchMapping mapping = new SearchMapping(); mapping .analyzerDef(LuceneAnalyzers.PHRASE_ANALYZER, KeywordTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class); mapping.analyzerDef(LuceneAnalyzers.EXACT_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class); mapping.analyzerDef(LuceneAnalyzers.START_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class) .filter(EdgeNGramFilterFactory.class) .param("minGramSize", "2") .param("maxGramSize", "20"); mapping.analyzerDef(LuceneAnalyzers.ANYWHERE_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class) .filter(NGramFilterFactory.class) .param("minGramSize", "2") .param("maxGramSize", "20"); mapping.analyzerDef(LuceneAnalyzers.SOUNDEX_ANALYZER, StandardTokenizerFactory.class) .filter(PhoneticFilterFactory.class) .param("encoder", "Soundex") .param("inject", "true"); return mapping; <START> } <END></code><technical_language>Remove unnecessary blank line</technical_language>

Target:
public SearchMapping getSearchMapping() { SearchMapping mapping = new SearchMapping(); mapping .analyzerDef(LuceneAnalyzers.PHRASE_ANALYZER, KeywordTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class); mapping.analyzerDef(LuceneAnalyzers.EXACT_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class); mapping.analyzerDef(LuceneAnalyzers.START_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class) .filter(EdgeNGramFilterFactory.class) .param("minGramSize", "2") .param("maxGramSize", "20"); mapping.analyzerDef(LuceneAnalyzers.ANYWHERE_ANALYZER, WhitespaceTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(ASCIIFoldingFilterFactory.class) .filter(NGramFilterFactory.class) .param("minGramSize", "2") .param("maxGramSize", "20"); mapping.analyzerDef(LuceneAnalyzers.SOUNDEX_ANALYZER, StandardTokenizerFactory.class) .filter(ClassicFilterFactory.class) .filter(LowerCaseFilterFactory.class) .filter(PhoneticFilterFactory.class) .param("encoder", "Soundex"); return mapping; }
Source:
<code>public void createSiteRequest(String type, Site site){ HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); if (type.equals(CREATE)) { CreateSiteRequest createSiteRequest = new CreateSiteRequest(mMainActivity, site, params, new Response.Listener<Site>() { @Override public void onResponse(Site site) { Log.e("successful site", "creation"); } }); mNetworkManager.getRequestQueue().add(createSiteRequest); SiteListFragment returnFragment = SiteListFragment.newInstance(); mMainActivity.replaceFragment(returnFragment); } else { EditSiteRequest editSiteRequest = new EditSiteRequest(mMainActivity, site, params, new Response.Listener<Site>() { @Override public void onResponse(Site site) { Log.e("successful site", "edit"); } }); mNetworkManager.getRequestQueue().add(editSiteRequest); <START> mMainActivity.getSupportFragmentManager().popBackStack(); <END> } }</code><technical_language>do stack a new instance of fragment above</technical_language>

Target:
public void createSiteRequest(String type, Site site){ HashMap<String, JSONObject> params = new HashMap<String, JSONObject>(); if (type.equals(CREATE)) { CreateSiteRequest createSiteRequest = new CreateSiteRequest(mMainActivity, site, params, new Response.Listener<Site>() { @Override public void onResponse(Site site) { Log.e("successful site", "creation"); } }); mNetworkManager.getRequestQueue().add(createSiteRequest); } else { EditSiteRequest editSiteRequest = new EditSiteRequest(mMainActivity, site, params, new Response.Listener<Site>() { @Override public void onResponse(Site site) { Log.e("successful site", "edit"); } }); mNetworkManager.getRequestQueue().add(editSiteRequest); } mMainActivity.getSupportFragmentManager().popBackStack(); }
Source:
<code>protected boolean canDoAction() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__RECONSTRUCT_MASTER); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__STORAGE__DOMAIN); List<storage_pool_iso_map> poolDomains = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map poolDomain : poolDomains) { if (poolDomain.getstatus() == StorageDomainStatus.Locked) { <START> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2); <END> addCanDoActionMessage(String.format("$status %1$s", getStorageDomain().getstatus())); return false; } } return InitializeVds(); }</code><technical_language>this formatted top of VdcBllMessage</technical_language>

Target:
protected boolean canDoAction() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__RECONSTRUCT_MASTER); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__STORAGE__DOMAIN); List<storage_pool_iso_map> poolDomains = DbFacade.getInstance() .getStoragePoolIsoMapDAO().getAllForStoragePool(getStoragePool().getId()); for (storage_pool_iso_map poolDomain : poolDomains) { if (poolDomain.getstatus() == StorageDomainStatus.Locked) { addStorageDomainStateIllegalMessage(poolDomain.getstatus()); return false; } } return InitializeVds(); }
Source:
<code>public void connectStoragePool() { Map<String, String> storageDomains = null; storageDomains = StoragePoolDomainHelper.buildStoragePoolDomainsMap(getParameters().getStorageDomains()); <START> log.info("executing with domain map: {}", storageDomains); <END> status = getBroker().connectStoragePool( getParameters().getStoragePoolId().toString(), getParameters().getVds().getVdsSpmId(), getParameters().getStoragePoolId().toString(), getParameters().getMasterDomainId().toString(), getParameters().getStoragePool().getMasterDomainVersion(), storageDomains); }</code><technical_language>1) /s/executing/Executing 2) I add this log in buildStoragePoolDomainsMap method for reconstruct get more information other storage domains statuses</technical_language>

Target:
public void connectStoragePool() { Map<String, String> storageDomains = null; storageDomains = StoragePoolDomainHelper.buildStoragePoolDomainsMap(getParameters().getStorageDomains()); log.info("Executing with domain map: {}", storageDomains); status = getBroker().connectStoragePool( getParameters().getStoragePoolId().toString(), getParameters().getVds().getVdsSpmId(), getParameters().getStoragePoolId().toString(), getParameters().getMasterDomainId().toString(), getParameters().getStoragePool().getMasterDomainVersion(), storageDomains); }
Source:
<code>public ConfigurationBuilder addServers(String servers) { <START> IpStackType stackType = InternetProtocols.getIpStackType(); <END> for (String server : servers.split(";")) { switch (stackType) { case IPv4: parseIPv4Server(server); break; case IPv6: parseIpV6Server(server); break; } } return this; }</code><technical_language>I parse IPv6 addresses java.net.preferIPv4Stack is set, parse IPv4 addresses java.net.preferIPv6Addresses is set</technical_language>

Target:
public ConfigurationBuilder addServers(String servers) { for (String server : servers.split(";")) { Matcher matcher = ADDRESS_PATTERN.matcher(server); if (matcher.matches()) { String v6host = matcher.group(2); String v4host = matcher.group(3); String host = v6host != null ? v6host : v4host; String portString = matcher.group(4); int port = portString == null ? ConfigurationProperties.DEFAULT_HOTROD_PORT : Integer.parseInt(portString); this.addServer().host(host).port(port); } else { throw log.parseErrorServerAddress(server); } } return this; }
Source:
<code>public final TreCollection parse(final NitfReader reader, final int treLength, final TreSource sourceSegment) throws NitfFormatException { TreCollection treCollection = new TreCollectionImpl(); int bytesRead = 0; while (bytesRead < treLength) { String tag = reader.readBytes(TreConstants.TAG_LENGTH); bytesRead += TreConstants.TAG_LENGTH; int fieldLength = reader.readBytesAsInteger(TreConstants.TAGLEN_LENGTH); bytesRead += TreConstants.TAGLEN_LENGTH; Tre tre = treParser.parseOneTre(reader, tag, fieldLength, sourceSegment); <START> if (tre != null) { <END> treCollection.add(tre); } bytesRead += fieldLength; } return treCollection; }</code><technical_language>I static imports</technical_language>

Target:
public final TreCollection parse(final NitfReader reader, final int treLength, final TreSource sourceSegment) throws NitfFormatException { TreCollection treCollection = new TreCollectionImpl(); int bytesRead = 0; while (bytesRead < treLength) { String tag = reader.readBytes(TAG_LENGTH); bytesRead += TAG_LENGTH; int fieldLength = reader.readBytesAsInteger(TAGLEN_LENGTH); bytesRead += TAGLEN_LENGTH; Tre tre = treParser.parseOneTre(reader, tag, fieldLength, sourceSegment); if (tre != null) { treCollection.add(tre); } bytesRead += fieldLength; } return treCollection; }