auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>ConditionalReplaceOperation(final ByteBuffer buffer, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { <START> OperationCode opCode = OperationCode.valueOf(buffer.get()); <END> validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int oldValueSize = buffer.getInt(); buffer.limit(buffer.position() + oldValueSize); ByteBuffer oldValueBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); ByteBuffer valueBlob = buffer.slice(); try { this.key = keySerializer.read(keyBlob); this.value = valueSerializer.read(valueBlob); this.oldValue = valueSerializer.read(oldValueBlob); } catch (ClassNotFoundException e) { throw new CodecException(e); } }</code><technical_language>fact write this here, default arg constructor BaseOperation protected fields indication is wrong in abstraction defined. I a lot of problems if BaseOperation deal values is left subclasses. fact values properly encapsulated</technical_language>

Target:
ConditionalReplaceOperation(final ByteBuffer buffer, final Serializer<K> keySerializer, final Serializer<V> valueSerializer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); if (opCode != getOpCode()) { throw new IllegalArgumentException("Invalid operation: " + opCode); } int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int oldValueSize = buffer.getInt(); buffer.limit(buffer.position() + oldValueSize); ByteBuffer oldValueBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); ByteBuffer valueBlob = buffer.slice(); try { this.key = keySerializer.read(keyBlob); this.oldValue = valueSerializer.read(oldValueBlob); this.newValue = valueSerializer.read(valueBlob); } catch (ClassNotFoundException e) { throw new CodecException(e); } }
Source:
<code>public void shouldGetOnlyNonEmptyCategories() { Set<ApiEntity> mockApis = new HashSet<>(); doReturn(mockApis).when(apiService).findPublishedByUser(any()); <START> existingCategories.stream() <END> .forEach(c -> { switch (c.getId()) { case "1": { doReturn(1L).when(categoryService).getTotalApisByCategory(mockApis, c) ; break; } default: { doReturn(0L).when(categoryService).getTotalApisByCategory(mockApis, c) ; break; } } }); final Response response = target().request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); Mockito.verify(apiService).findPublishedByUser(any()); CategoriesResponse categoriesResponse = response.readEntity(CategoriesResponse.class); assertEquals(1, categoriesResponse.getData().size()); }</code><technical_language>simplify, I written this mock in method. impact previous test since, getTotalApisByCategory mock is overridden</technical_language>

Target:
public void shouldGetOnlyNonEmptyCategories() { final Response response = target().request().get(); assertEquals(HttpStatusCode.OK_200, response.getStatus()); Mockito.verify(apiService).findPublishedByUser(any()); CategoriesResponse categoriesResponse = response.readEntity(CategoriesResponse.class); assertEquals(1, categoriesResponse.getData().size()); }
Source:
<code><START> public static void validateServerId(long serverId) { <END> if ( extendedEphemeralTypesEnabled() ) { if (serverId > EphemeralType.MAX_TTL_SERVER_ID) { throw new RuntimeException("extendedTypesEnabled is true but Server ID is too large. Cannot be larger than " + EphemeralType.MAX_TTL_SERVER_ID); } } }</code><technical_language>start server if server id is conflict TTL feature, do this in QuorumPeerConfig.checkValidity</technical_language>

Target:
public static void validateServerId(long serverId) { if (extendedEphemeralTypesEnabled()) { if (serverId > EphemeralType.MAX_EXTENDED_SERVER_ID) { throw new RuntimeException("extendedTypesEnabled is true but Server ID is too large. Cannot be larger than " + EphemeralType.MAX_EXTENDED_SERVER_ID); } } }
Source:
<code>public Value getValue(Session session) { Value l = left.getValue(session); if (l == ValueNull.INSTANCE) { return l; } int size = valueList.size(); if (size == 1) { Expression e = valueList.get(0); if (e instanceof TableFunction) { return ConditionInParameter.getValue(database, l, e.getValue(session)); } } boolean hasNull = false; for (int i = 0; i < size; i++) { Expression e = valueList.get(i); Value r = e.getValue(session); Value cmp; if (r == ValueNull.INSTANCE || (cmp = Comparison.compareNotNull(database, l, r, Comparison.EQUAL)) == ValueNull.INSTANCE) { hasNull = true; <START> } else if (cmp == ValueBoolean.TRUE) { <END> return cmp; } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.FALSE; }</code><technical_language>this chunk of code is hard understand assigning cmp condition testing cmp in else</technical_language>

Target:
public Value getValue(Session session) { Value l = left.getValue(session); if (l.containsNull()) { return ValueNull.INSTANCE; } int size = valueList.size(); if (size == 1) { Expression e = valueList.get(0); if (e instanceof TableFunction) { return ConditionInParameter.getValue(database, l, e.getValue(session)); } } boolean hasNull = false; for (int i = 0; i < size; i++) { Expression e = valueList.get(i); Value r = e.getValue(session); Value cmp = Comparison.compare(database, l, r, Comparison.EQUAL); if (cmp == ValueNull.INSTANCE) { hasNull = true; } else if (cmp == ValueBoolean.TRUE) { return cmp; } } if (hasNull) { return ValueNull.INSTANCE; } return ValueBoolean.FALSE; }
Source:
<code>public void testSymlinkPutHidden() throws Exception { if (!isAttributeSupported(EFS.ATTRIBUTE_HIDDEN)) return; if (!canCreateSymLinks()) return; makeLinkStructure(); illFile.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llFile.putInfo(illFile, EFS.SET_ATTRIBUTES, getMonitor()); illFile = llFile.fetchInfo(); <START> assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); <END> illDir.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llDir.putInfo(illDir, EFS.SET_ATTRIBUTES, getMonitor()); illDir = llDir.fetchInfo(); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illFile = llFile.fetchInfo(); illDir = llDir.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }</code><technical_language>good, add assertFalse(iFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); assert attribute propagated file, a similar for directory below</technical_language>

Target:
public void testSymlinkPutHidden() throws Exception { if (!isAttributeSupported(EFS.ATTRIBUTE_HIDDEN)) return; if (!canCreateSymLinks()) return; makeLinkStructure(); illFile.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llFile.putInfo(illFile, EFS.SET_ATTRIBUTES, getMonitor()); illFile = llFile.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); iFile = aFile.fetchInfo(); assertFalse(iFile.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illDir.setAttribute(EFS.ATTRIBUTE_HIDDEN, true); llDir.putInfo(illDir, EFS.SET_ATTRIBUTES, getMonitor()); illDir = llDir.fetchInfo(); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); iDir = aDir.fetchInfo(); assertFalse(iDir.getAttribute(EFS.ATTRIBUTE_HIDDEN)); illFile = llFile.fetchInfo(); illDir = llDir.fetchInfo(); assertTrue(illFile.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertTrue(illDir.getAttribute(EFS.ATTRIBUTE_SYMLINK)); assertEquals(illFile.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lFile"); assertEquals(illDir.getStringAttribute(EFS.ATTRIBUTE_LINK_TARGET), "lDir"); }
Source:
<code>private boolean valueCompare(Object actual, String operator, Object expected) { boolean passed; <START> if (operator.equals("$eq") || operator.equals("$in")) { <END> passed = compareEq(actual, expected); } else if (operator.equals("$lt")) { passed = compareLT(actual, expected); } else if (operator.equals("$lte")) { passed = compareLTE(actual, expected); } else if (operator.equals("$gt")) { passed = compareGT(actual, expected); } else if (operator.equals("$gte")) { passed = compareGTE(actual, expected); } else if (operator.equals("$exists")) { boolean expectedBool = (Boolean) expected; boolean exists = (actual != null); passed = (exists == expectedBool); } else { String msg = String.format("Found unexpected operator in selector: %s", operator); logger.log(Level.WARNING, msg); passed = false; } return passed; }</code><technical_language>move this constants if changing line</technical_language>

Target:
private boolean valueCompare(Object actual, String operator, Object expected) { boolean passed; if (operator.equals(EQ)) { passed = compareEq(actual, expected); } else if (operator.equals(LT)) { passed = compareLT(actual, expected); } else if (operator.equals(LTE)) { passed = compareLTE(actual, expected); } else if (operator.equals(GT)) { passed = compareGT(actual, expected); } else if (operator.equals(GTE)) { passed = compareGTE(actual, expected); } else if (operator.equals(EXISTS)) { boolean expectedBool = (Boolean) expected; boolean exists = (actual != null); passed = (exists == expectedBool); } else { String msg = String.format("Found unexpected operator in selector: %s", operator); logger.log(Level.WARNING, msg); passed = false; } return passed; }
Source:
<code>public EnterXMPPAccountComposite(Composite composite, int style) { super(composite, style); super.setLayout(new GridLayout(2, false)); SarosPluginContext.initComponent(this); Label jidLabel = new Label(this, SWT.NONE); jidLabel.setText(Messages.jid_shortform); Combo combo = new Combo(this, SWT.BORDER); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); this.jidCombo = new JIDCombo(combo); Label passwordLabel = new Label(this, SWT.NONE); passwordLabel.setText("Password"); passwordText = new Text(this, SWT.BORDER); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passwordText.setEchoChar('*'); new Label(this, SWT.NONE); serverOptionsExpandableComposite = new ExpandableComposite( this, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); serverOptionsExpandableComposite.setText("Advanced Options"); serverOptionsExpandableComposite.addExpansionListener( new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getParent().layout(); } }); createServerExpandableCompositeContent(); <START> if (CreateXMPPAccountWizard.CREATE_DIALOG_ENABLED) { <END> createAccountButton = new Button(this, SWT.PUSH); createAccountButton.setText(Messages.ConfigurationWizard_button_create_account); } hookListeners(); }</code><technical_language>I do understand checks. I click a button is disabled visible. check in class all</technical_language>

Target:
public EnterXMPPAccountComposite(Composite composite, int style) { super(composite, style); super.setLayout(new GridLayout(2, false)); SarosPluginContext.initComponent(this); Label jidLabel = new Label(this, SWT.NONE); jidLabel.setText(Messages.jid_shortform); Combo combo = new Combo(this, SWT.BORDER); combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); this.jidCombo = new JIDCombo(combo); Label passwordLabel = new Label(this, SWT.NONE); passwordLabel.setText("Password"); passwordText = new Text(this, SWT.BORDER); passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); passwordText.setEchoChar('*'); new Label(this, SWT.NONE); serverOptionsExpandableComposite = new ExpandableComposite( this, SWT.NONE, ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT); serverOptionsExpandableComposite.setText("Advanced Options"); serverOptionsExpandableComposite.addExpansionListener( new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { getParent().layout(); } }); createServerExpandableCompositeContent(); createAccountButton = new Button(this, SWT.PUSH); createAccountButton.setText(Messages.ConfigurationWizard_button_create_account); createAccountButton.setVisible(CreateXMPPAccountWizard.CREATE_DIALOG_ENABLED); hookListeners(); }
Source:
<code>private boolean hasSnappableDisks() { getDisksBasedOnImage(); <START> return !disksImages.isEmpty(); <END> }</code><technical_language>flaged "Done suggestion previous patchset, I change. Is this intentional</technical_language>

Target:
private boolean hasSnappableDisks() { return !getDisksBasedOnImage().isEmpty(); }
Source:
<code>private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 <START> && code != 503) { END> return retryStrategy.calculateRetryDelay(tryCount); } return retryStrategy.calculateRetryDelay(response, tryCount); }</code><technical_language>thoughts moving 429 503 checks RetryStrategy::calculateRetryDelay(HttpResponse, int) well? this ensure RetryStrategy::calculateRetryDelay(HttpResponse, int) is called</technical_language>

Target:
private Duration determineDelayDuration(HttpResponse response, int tryCount) { int code = response.getStatusCode(); if (code != 429 && code != 503) { return retryStrategy.calculateRetryDelay(tryCount); } String retryHeaderValue = null; if (!isNullOrEmpty(this.retryAfterHeader)) { retryHeaderValue = response.getHeaderValue(this.retryAfterHeader); } if (isNullOrEmpty(retryHeaderValue)) { return this.retryStrategy.calculateRetryDelay(tryCount); } return Duration.of(Integer.parseInt(retryHeaderValue), this.retryAfterTimeUnit); }
Source:
<code>private Organization stubOrgObject() { String markdownDescription = "An h1 header ============ Paragraphs are separated by a blank line. 2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists look like: * this one * that one * the other one Note that --- not considering the asterisk --- the actual text content starts at 4-columns in. > Block quotes are > written like so. > > They can span multiple paragraphs, > if you like. Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., \"it's all in chapters 12--14\"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺ "; Organization organization = new Organization(); organization.setName("testname"); organization.setDisplayName("test name"); organization.setLocation("testlocation"); organization.setLink("<LINK_1>"); organization.setEmail("test@email.com"); organization.setDescription(markdownDescription); <START> organization.setTopic("his is a short topic"); <END> organization.setAvatarUrl("<LINK_0>"); return organization; }</code><technical_language>confused:</technical_language>

Target:
private Organization stubOrgObject() { String markdownDescription = "An h1 header ============ Paragraphs are separated by a blank line. 2nd paragraph. *Italic*, **bold**, and `monospace`. Itemized lists look like: * this one * that one * the other one Note that --- not considering the asterisk --- the actual text content starts at 4-columns in. > Block quotes are > written like so. > > They can span multiple paragraphs, > if you like. Use 3 dashes for an em-dash. Use 2 dashes for ranges (ex., \"it's all in chapters 12--14\"). Three dots ... will be converted to an ellipsis. Unicode is supported. ☺ "; Organization organization = new Organization(); organization.setName("testname"); organization.setDisplayName("test name"); organization.setLocation("testlocation"); organization.setLink("<LINK_1>"); organization.setEmail("test@email.com"); organization.setDescription(markdownDescription); organization.setTopic("This is a short topic"); organization.setAvatarUrl("<LINK_0>"); return organization; }
Source:
<code><START> public boolean hasMultipleValues(final String dimension) <END> { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues().isMaybeTrue(); } final ColumnHolder columnHolder = index.getColumnHolder(dimension); return columnHolder != null && columnHolder.getCapabilities().hasMultipleValues().isMaybeTrue(); }</code><technical_language>IMO, if this returns a Capable. caller decide do unknowns</technical_language>

Target:
public ColumnCapabilities.Capable hasMultipleValues(final String dimension) { if (isVirtualColumn(dimension)) { return virtualColumns.getVirtualColumn(dimension).capabilities(dimension).hasMultipleValues(); } final ColumnHolder columnHolder = index.getColumnHolder(dimension); return columnHolder != null ? columnHolder.getCapabilities().hasMultipleValues() : ColumnCapabilities.Capable.FALSE; }
Source:
<code>private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws <START> OrmException, SQLException <END> { ResultSet cols = meta.getPrimaryKeys(null, null, tableName.toUpperCase()); try { Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.add(name.toUpperCase(Locale.US)); } return pk; } finally { cols.close(); } }</code><technical_language>thrown</technical_language>

Target:
private List<String> dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); } List<String> pk = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }
Source:
<code>public List<Object[]> execute() { List<Object[]> tuples = delegate().execute(); QueryResults.Columns columns = getColumns(); if (tuples.size() > 1) { Iterator<Object[]> iter = tuples.iterator(); int locationCount = columns.getLocationCount(); Set<List<Location>> found = new HashSet<List<Location>>(); while (iter.hasNext()) { Object[] tuple = iter.next(); List<Location> locations = new ArrayList<Location>(locationCount); for (String selectorName : columns.getSelectorNames()) { locations.add((Location)tuple[columns.getLocationIndex(selectorName)]); <START> } <END> if (!found.add(locations)) { iter.remove(); } } } return tuples; }</code><technical_language>Is pre-compute processing tuples? computing array of integers represent (ordered) location indexes for selectors? want re-computing indexes while processing tuples</technical_language>

Target:
public List<Object[]> execute() { List<Object[]> tuples = delegate().execute(); if (!tuples.isEmpty()) { QueryResults.Columns columns = getColumns(); int locationCount = columns.getLocationCount(); int[] locationIndexes = super.getLocationIndexes(columns); Iterator<Object[]> iter = tuples.iterator(); Set<List<Location>> found = new HashSet<List<Location>>(); while (iter.hasNext()) { Object[] tuple = iter.next(); List<Location> locations = new ArrayList<Location>(locationCount); for (int locationIndex : locationIndexes) { locations.add((Location)tuple[locationIndex]); } if (!found.add(locations)) { iter.remove(); } } } return tuples; }
Source:
<code>public CreateContainerOptions headers(Multimap<String, String> headers) { <START> if (!headers.isEmpty()) { <END> this.headers.putAll(headers); } return this; }</code><technical_language>Optimization? putAll expensive if put..</technical_language>

Target:
public CreateContainerOptions headers(Multimap<String, String> headers) { this.headers.putAll(headers); return this; }
Source:
<code>protected void executeCommand() { setStoragePoolId(getNetwork().getDataCenterId()); if (Boolean.TRUE.equals(getParameters().getRemoveFromNetworkProvider()) && getNetwork().isExternal()) { <START> removeExternalNetwork(); <END> } removeVnicProfiles(); getNetworkDAO().remove(getNetwork().getId()); setSucceeded(true); }</code><technical_language>do want action dependent external provider</technical_language>

Target:
protected void executeCommand() { setStoragePoolId(getNetwork().getDataCenterId()); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void> () { @Override public Void runInTransaction() { removeVnicProfiles(); getCompensationContext().snapshotEntity(getNetwork()); getNetworkDAO().remove(getNetwork().getId()); getCompensationContext().stateChanged(); return null; } }); if (getParameters().isRemoveFromNetworkProvider() && getNetwork().isExternal()) { removeExternalNetwork(); } setSucceeded(true); }
Source:
<code>protected void processNewBinding(MethodCallExpr accumulateDSL) { <START> this.accumulateDSL = accumulateDSL; <END> optNewBinding.ifPresent(newBinding -> { final List<Expression> allExpressions = context.getExpressions(); final MethodCallExpr newBindingExpression = newBinding.bindExpression; final SortedSet<String> patterBinding = new TreeSet<>(newBinding.patternBinding); if (patterBinding.size() == 2 && findLastBinding(allExpressions) != null) { Optional<MethodCallExpr> lastBinding = Optional.ofNullable(findLastBinding(allExpressions)); composeTwoBindingIntoExpression(newBindingExpression, lastBinding); } else { replaceBindingWithPatternBinding( newBindingExpression, findLastPattern(allExpressions) ); newBindingResults.add( newBinding ); } }); }</code><technical_language>Nitpick: accumulateDSL instance variable instead of passing composeTwoBindingIntoExpression method</technical_language>

Target:
protected void processNewBinding(MethodCallExpr accumulateDSL) { optNewBinding.ifPresent(newBinding -> { final List<Expression> allExpressions = context.getExpressions(); final MethodCallExpr newBindingExpression = newBinding.bindExpression; final SortedSet<String> patterBinding = new TreeSet<>(newBinding.patternBinding); if (patterBinding.size() == 2 && findLastBinding(allExpressions) != null) { Optional<MethodCallExpr> lastBinding = Optional.ofNullable(findLastBinding(allExpressions)); composeTwoBindingIntoExpression(newBindingExpression, lastBinding, accumulateDSL); } else { replaceBindingWithPatternBinding( newBindingExpression, findLastPattern(allExpressions) ); newBindingResults.add( newBinding ); } }); }
Source:
<code>public void open() throws IOException { writer = CompressionFactory.getFloatSerializer( ioPeon, <START> StringUtils.safeFormat("%s.float_column", filenameBase), <END> byteOrder, compression ); writer.open(); }</code><technical_language>crash if bad format string</technical_language>

Target:
public void open() throws IOException { writer = CompressionFactory.getFloatSerializer( ioPeon, StringUtils.format("%s.float_column", filenameBase), byteOrder, compression ); writer.open(); }
Source:
<code>private void fetchBatchOfTimestampsBeginningAtStartRow() { byte[] rangeStart = startRowInclusive; <START> ExecutorService executor = PTExecutors.newFixedThreadPool(config.sweepReadThreads()); <END> while (timestamps.isEmpty()) { List<byte[]> rows = getRows(rangeStart); if (rows.isEmpty()) { return; } List<CellWithTimestamp> batch = cqlExecutor.getTimestamps(tableRef, rows, batchHint, executor); timestamps.addAll(batch); rangeStart = RangeRequests.nextLexicographicName(Iterables.getLast(rows)); } executor.shutdown(); }</code><technical_language>Huh, this of I thought happen - I thought executor service created destroyed CqlExecutor.getTimestamps. I this equivalent, though: timestamps.isEmpty false iteration in cases sweeping a table batchHint rows of tombstones in front of us</technical_language>

Target:
private void fetchBatchOfTimestampsBeginningAtStartRow() { byte[] rangeStart = startRowInclusive; Integer executorThreads = config.sweepReadThreads(); ExecutorService executor = PTExecutors.newFixedThreadPool(executorThreads); while (timestamps.isEmpty()) { List<byte[]> rows = getRows(rangeStart); if (rows.isEmpty()) { return; } List<CellWithTimestamp> batch = cqlExecutor.getTimestamps(tableRef, rows, batchHint, executor, executorThreads); timestamps.addAll(batch); rangeStart = RangeRequests.nextLexicographicName(Iterables.getLast(rows)); } executor.shutdown(); }
Source:
<code>public static void main(String[] args) { EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); Map<String, String> env = System.getenv(); final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key()); Preconditions.checkArgument( workingDirectory != null, "Working directory variable (%s) not set", ApplicationConstants.Environment.PWD.key()); try { YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG); } catch (IOException e) { LOG.warn("Could not log YARN environment information.", e); } <START> final CommandLineParser<Configuration> commandLineParser = new CommandLineParser<>(new DynamicParametersConfigurationParserFactory()); Configuration dynamicParameters = null; try { dynamicParameters = commandLineParser.parse(args); } catch (FlinkParseException e) { LOG.error("Could not parse command line arguments {}.", args, e); commandLineParser.printHelp(YarnSessionClusterEntrypoint.class.getSimpleName()); System.exit(1); } <END> Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, dynamicParameters, env); YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration); ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint); }</code><technical_language>introduce private static <T> T parseArgumentsOrExit( Logger logger, String componentName, String[] args, ParserResultFactory<T> parserResultFactory) { final CommandLineParser<T> commandLineParser = new CommandLineParser<>(parserResultFactory); try { return commandLineParser.parse(args); } catch (FlinkParseException e) { logger.error("Could parse command line arguments {}.", args, e); commandLineParser.printHelp(componentName); System.exit(1); return null; } } ClusterEntrypointUtils cluster entrypoints. This ensure fail a consistent error code if parsing fails</technical_language>

Target:
public static void main(String[] args) { EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); Map<String, String> env = System.getenv(); final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key()); Preconditions.checkArgument( workingDirectory != null, "Working directory variable (%s) not set", ApplicationConstants.Environment.PWD.key()); try { YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG); } catch (IOException e) { LOG.warn("Could not log YARN environment information.", e); } final Configuration dynamicParameters = ClusterEntrypointUtils.parseParametersOrExit( args, new DynamicParametersConfigurationParserFactory(), YarnSessionClusterEntrypoint.class); final Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, dynamicParameters, env); YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration); ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint); }
Source:
<code>public PredicateFinalStep visit(FullTextTermExpr fullTextTermExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextTermExpr.getChild(); String text = fullTextTermExpr.getTerm(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); <START> <END> int asteriskPos = text.indexOf(LUCENE_MULTIPLE_CHARACTERS_WILDCARD); int questionPos = text.indexOf(LUCENE_SINGLE_CHARACTER_WILDCARD); if (asteriskPos == -1 && questionPos == -1) { if (isMultiTermText(propertyValueExpr.getPropertyPath(), text)) { PhrasePredicateOptionsStep<?> result = predicateFactory.phrase().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.slop(fullTextTermExpr.getFuzzySlop()); } return result; } else { MatchPredicateOptionsStep<?> result = predicateFactory.match().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.fuzzy(fullTextTermExpr.getFuzzySlop()); } return result; } } else { if (fullTextTermExpr.getFuzzySlop() != null) { throw CONTAINER.getPrefixWildcardOrRegexpQueriesCannotBeFuzzy(fullTextTermExpr.toQueryString()); } if (questionPos == -1 && asteriskPos == text.length() - 1) { return predicateFactory.simpleQueryString() .field(absoluteFieldPath).matching(text); } return predicateFactory.wildcard() .field(absoluteFieldPath).matching(text); } }</code><technical_language>else: throw exception, is wrong</technical_language>

Target:
public PredicateFinalStep visit(FullTextTermExpr fullTextTermExpr) { PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextTermExpr.getChild(); String text = fullTextTermExpr.getTerm(); String absoluteFieldPath = propertyValueExpr.getPropertyPath().asStringPath(); int asteriskPos = text.indexOf(LUCENE_MULTIPLE_CHARACTERS_WILDCARD); int questionPos = text.indexOf(LUCENE_SINGLE_CHARACTER_WILDCARD); if (asteriskPos == -1 && questionPos == -1) { if (isMultiTermText(propertyValueExpr.getPropertyPath(), text)) { PhrasePredicateOptionsStep<?> result = predicateFactory.phrase().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.slop(fullTextTermExpr.getFuzzySlop()); } return result; } else { MatchPredicateOptionsStep<?> result = predicateFactory.match().field(absoluteFieldPath).matching(text); if (fullTextTermExpr.getFuzzySlop() != null) { result.fuzzy(fullTextTermExpr.getFuzzySlop()); } return result; } } else { if (fullTextTermExpr.getFuzzySlop() != null) { throw CONTAINER.getPrefixWildcardOrRegexpQueriesCannotBeFuzzy(fullTextTermExpr.toQueryString()); } if (questionPos == -1 && asteriskPos == text.length() - 1) { return predicateFactory.simpleQueryString() .field(absoluteFieldPath).matching(text) .flags(SimpleQueryFlag.PREFIX); } return predicateFactory.wildcard() .field(absoluteFieldPath).matching(text); } }
Source:
<code>public void remove(String noteId, AuthenticationInfo subject) throws IOException { DistributedFileSystemOps dfso = null; try { dfso = getDfs(superuser); Path rootDir = getRootDir(dfso); String hdfsOwner = dfso.getFileStatus(rootDir).getOwner(); Matcher psuMatcher = psuPattern.matcher(hdfsOwner); if (psuMatcher.matches()) { String extractedPSUProjectname = psuMatcher.group(1); Matcher pguMatcher = pguPattern.matcher(subject.getUser()); if (pguMatcher.matches()) { String extractedPGUProjectname = pguMatcher.group(1); if (!extractedPSUProjectname.equals(extractedPGUProjectname)) { throw new IOException("User <" + subject.getUser() + "> does not " + "belong to project"); } } } Path noteDir = new Path(rootDir, noteId); if (!dfso.getFilesystem().exists(noteDir)) { return; } if (!dfso.getFilesystem().isDirectory(noteDir)) { throw new IOException("Can not remove " + noteDir.toString()); } dfso.getFilesystem().delete(noteDir, true); } finally { if (dfso != null) { dfso.close(); <START> } <END> } }</code><technical_language>@kouzant more coherent, for dfso difference, closeDfsClient()</technical_language>

Target:
public void remove(String noteId, AuthenticationInfo subject) throws IOException { DistributedFileSystemOps dfso = null; try { dfso = getDfs(superuser); Path rootDir = getRootDir(dfso); String hdfsOwner = dfso.getFileStatus(rootDir).getOwner(); Matcher psuMatcher = psuPattern.matcher(hdfsOwner); if (psuMatcher.matches()) { String extractedPSUProjectname = psuMatcher.group(1); Matcher pguMatcher = pguPattern.matcher(subject.getUser()); if (pguMatcher.matches()) { String extractedPGUProjectname = pguMatcher.group(1); if (!extractedPSUProjectname.equals(extractedPGUProjectname)) { throw new IOException("User <" + subject.getUser() + "> does not " + "belong to project"); } } } Path noteDir = new Path(rootDir, noteId); if (!dfso.getFilesystem().exists(noteDir)) { return; } if (!dfso.getFilesystem().isDirectory(noteDir)) { throw new IOException("Can not remove " + noteDir.toString()); } dfso.getFilesystem().delete(noteDir, true); } finally { if (dfso != null) { dfsService.closeDfsClient(dfso); } } }
Source:
<code>public NamedCluster fromXmlForEmbed( Node node ) { NamedClusterImpl returnCluster = this.clone(); List<Node> fields = XMLHandler.getNodes( node, "child" ); for ( Node field: fields ) { String fieldName = XMLHandler.getTagValue( field, "id" ); System.out.println( fieldName ); String fieldValue = XMLHandler.getTagValue( field, "value" ); if ( fieldName.toLowerCase().contains( "password" ) ) { fieldValue = passwordEncoder.decode( fieldValue ); } try { BeanUtils.setProperty( returnCluster, fieldName, fieldValue ); } catch ( IllegalAccessException | InvocationTargetException e ) { e.printStackTrace(); <START> return null; <END> } } return returnCluster; }</code><technical_language>Log this</technical_language>

Target:
public NamedCluster fromXmlForEmbed( Node node ) { NamedClusterImpl returnCluster = this.clone(); List<Node> fields = XMLHandler.getNodes( node, "child" ); for ( Node field: fields ) { String fieldName = XMLHandler.getTagValue( field, "id" ); System.out.println( fieldName ); String fieldValue = XMLHandler.getTagValue( field, "value" ); if ( fieldName.toLowerCase().contains( "password" ) ) { fieldValue = passwordEncoder.decode( fieldValue ); } try { BeanUtils.setProperty( returnCluster, fieldName, fieldValue ); } catch ( IllegalAccessException | InvocationTargetException e ) { LOGGER.error( "Could not serialize NamedCluster to xml: " + e.toString() ); } } return returnCluster; }
Source:
<code>private long getSortPopVal(long popSize) { if (popSize > 400_000) { return GeoCodingConstants.POPULATION_OVER_400K; } else if (popSize > 350_000 && popSize <= 400_000) { return GeoCodingConstants.POPULATION_LT_400K_GT_350K; } else if (popSize > 300_000 && popSize <= 350_000) { return GeoCodingConstants.POPULATION_LT_350K_GT_300K; } else if (popSize > 250_000 && popSize <= 300_000) { return GeoCodingConstants.POPULATION_LT_300K_GT_250K; } else if (popSize > 200_000 && popSize <= 250_000) { return GeoCodingConstants.POPULATION_LT_250K_GT_200K; } else if (popSize > 150_000 && popSize <= 200_000) { return GeoCodingConstants.POPULATION_LT_200K_GT_150K; } else if (popSize > 100_000 && popSize <= 150_000) { return GeoCodingConstants.POPULATION_LT_150K_GT_100K; } else if (popSize > 50_000 && popSize <= 100_000) { return GeoCodingConstants.POPULATION_LT_100K_GT_50K; } else { return GeoCodingConstants.POPULATION_UNDER_50K; } <START> } <END></code><technical_language>replace this roughly return Math.max(2, Math.min(10, popSize/40000))</technical_language>

Target:
private long getSortPopVal(long popSize) { return Math.min(10, (popSize - 1) / 50_000 + 2); }
Source:
<code>public Builder<ProtocolConfiguration<P>> configure(OperationContext context, ModelNode model) throws OperationFailedException { <START> List<ValueDependency<OutboundSocketBinding>> list = new ArrayList<>(); <END> for (String binding : StringListAttributeDefinition.unwrapValue(context, OUTBOUND_SOCKET_BINDINGS.resolveModelAttribute(context, model))) { InjectedValueDependency<OutboundSocketBinding> outboundSocketBindingInjectedValueDependency = new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding), OutboundSocketBinding.class); list.add(outboundSocketBindingInjectedValueDependency); } this.bindings = list; return super.configure(context, model); }</code><technical_language>ArrayList constructed fixed capacity</technical_language>

Target:
public Builder<ProtocolConfiguration<P>> configure(OperationContext context, ModelNode model) throws OperationFailedException { final List<String> value = StringListAttributeDefinition.unwrapValue(context, OUTBOUND_SOCKET_BINDINGS.resolveModelAttribute(context, model)); List<ValueDependency<OutboundSocketBinding>> list = new ArrayList<>(value.size()); for (String binding : value) { list.add(new InjectedValueDependency<>(CommonUnaryRequirement.OUTBOUND_SOCKET_BINDING.getServiceName(context, binding), OutboundSocketBinding.class)); } this.bindings = list; return super.configure(context, model); }
Source:
<code>private Set<Vector> cornerNeighbors(final Vector v) { <START> Vector[] diagnolVectors = new Vector[] { <END> new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() - 1) }; return new HashSet<>(Arrays.asList(diagnolVectors)); }</code><technical_language>diagonal</technical_language>

Target:
private Set<Vector> cornerNeighbors(final Vector v) { Vector[] cornerVectors = new Vector[] { new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() + 1, v.getBlockZ() - 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() + 1, v.getBlockY() - 1, v.getBlockZ() - 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() + 1), new Vector(v.getBlockX() - 1, v.getBlockY() - 1, v.getBlockZ() - 1) }; return new HashSet<>(Arrays.asList(cornerVectors)); }
Source:
<code>public static String sha256Hash(Object data, int len) throws NoSuchAlgorithmException, IOException, InsufficientDataException, InternalException { MessageDigest sha256Digest = MessageDigest.getInstance("SHA-256"); if (data instanceof BufferedInputStream || data instanceof RandomAccessFile) { updateDigests(data, len, sha256Digest, null); } else if (data instanceof byte[]) { sha256Digest.update((byte[]) data, 0, len); } else { <START> throw new InternalException("unknown data to calculate SHA256 hash. This should not happend. " <END> + "Please report this issue at <LINK_0>"); } return BaseEncoding.base16().encode(sha256Digest.digest()).toLowerCase(); }</code><technical_language>Unknown data source calculate sha256 hash. This happen, please report this issue <LINK_0> - is i think</technical_language>

Target:
public static String sha256Hash(Object data, int len) throws NoSuchAlgorithmException, IOException, InsufficientDataException, InternalException { MessageDigest sha256Digest = MessageDigest.getInstance("SHA-256"); if (data instanceof BufferedInputStream || data instanceof RandomAccessFile) { updateDigests(data, len, sha256Digest, null); } else if (data instanceof byte[]) { sha256Digest.update((byte[]) data, 0, len); } else { throw new InternalException("Unknown data source to calculate sha256 hash. This should not happen, " + "please report this issue at <LINK_0>"); } return BaseEncoding.base16().encode(sha256Digest.digest()).toLowerCase(); }
Source:
<code><START> Optional<String> getCredentials() { <END> return Optional.ofNullable(basicCredentials); }</code><technical_language>this @Nullable instead of Optional</technical_language>

Target:
String getCredentials() { return basicCredentials; }
Source:
<code>public static void classSetup() { locatorProperties = new Properties(); serverProperties1 = new Properties(); serverProperties2 = new Properties(); serverProperties3 = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); serverProperties1.setProperty(REDIS_PORT, "6371"); serverProperties1.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties2.setProperty(REDIS_PORT, "6372"); serverProperties2.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties3.setProperty(REDIS_PORT, "6373"); serverProperties3.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); locator = clusterStartUp.startLocatorVM(0, locatorProperties); server1 = clusterStartUp.startServerVM(1, serverProperties1, locator.getPort()); server2 = clusterStartUp.startServerVM(2, serverProperties2, locator.getPort()); server3 = clusterStartUp.startServerVM(3, serverProperties3, locator.getPort()); <START> jedis1 = new Jedis(LOCAL_HOST, 6371); <END> jedis2 = new Jedis(LOCAL_HOST, 6372); jedis3 = new Jedis(LOCAL_HOST, 6373); }</code><technical_language>I if hard coded port numbers (6371, 6372, 6373) is causing stressNewTest fail. I instead test call AvailablePortHelper.getRandomAvailableTCPPort(3) give array of 3 ints</technical_language>

Target:
public static void classSetup() { availablePorts = AvailablePortHelper.getRandomAvailableTCPPorts(3); locatorProperties = new Properties(); serverProperties1 = new Properties(); serverProperties2 = new Properties(); serverProperties3 = new Properties(); locatorProperties.setProperty(MAX_WAIT_TIME_RECONNECT, "15000"); serverProperties1.setProperty(REDIS_PORT, Integer.toString(availablePorts[0])); serverProperties1.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties2.setProperty(REDIS_PORT, Integer.toString(availablePorts[1])); serverProperties2.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); serverProperties3.setProperty(REDIS_PORT, Integer.toString(availablePorts[2])); serverProperties3.setProperty(REDIS_BIND_ADDRESS, LOCAL_HOST); locator = clusterStartUp.startLocatorVM(0, locatorProperties); server1 = clusterStartUp.startServerVM(1, serverProperties1, locator.getPort()); server2 = clusterStartUp.startServerVM(2, serverProperties2, locator.getPort()); server3 = clusterStartUp.startServerVM(3, serverProperties3, locator.getPort()); jedis1 = new Jedis(LOCAL_HOST, availablePorts[0], JEDIS_TIMEOUT); jedis2 = new Jedis(LOCAL_HOST, availablePorts[1], JEDIS_TIMEOUT); jedis3 = new Jedis(LOCAL_HOST, availablePorts[2], JEDIS_TIMEOUT); }
Source:
<code>private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName contextServiceName) { BinderService inAppClientContainerService = new BinderService("InAppClientContainer"); final ServiceName inAppClientServiceName = contextServiceName.append("InAppClientContainer"); inAppClientContainerService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(Values.immediateValue(appclient))); serviceTarget.addService(inAppClientServiceName, inAppClientContainerService) .addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector()) .install(); final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES); <START> final Set<ServiceName> jndiDependencies = jndiComponentDependencies.computeIfAbsent(contextServiceName, k-> new HashSet<>()); <END> jndiDependencies.add(inAppClientServiceName); }</code><technical_language>a lambda this instead a lines do a get if null, a put, adds amount of metaspace server needs</technical_language>

Target:
private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName contextServiceName) { BinderService inAppClientContainerService = new BinderService("InAppClientContainer"); final ServiceName inAppClientServiceName = contextServiceName.append("InAppClientContainer"); inAppClientContainerService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(Values.immediateValue(appclient))); serviceTarget.addService(inAppClientServiceName, inAppClientContainerService) .addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector()) .install(); final Map<ServiceName, Set<ServiceName>> jndiComponentDependencies = deploymentUnit.getAttachment(org.jboss.as.server.deployment.Attachments.COMPONENT_JNDI_DEPENDENCIES); Set<ServiceName> jndiDependencies = jndiComponentDependencies.get(contextServiceName); if (jndiDependencies == null) { jndiComponentDependencies.put(contextServiceName, jndiDependencies = new HashSet<>()); } jndiDependencies.add(inAppClientServiceName); }
Source:
<code>public void testExtractValues() throws Exception { @SuppressWarnings("serial") <START> FieldApprover notNullDataInfoFieldApprover = new FieldApprover() { @Override public boolean approve(DataInfo dataInfo) { return dataInfo != null; } }; <END> DataInfo dataInfo = new DataInfo(); Collection<StructuredProperty> source = Lists.newArrayList(); String validValue = "someValue"; source.add(generateStructuredProperty(validValue, dataInfo)); source.add(generateStructuredProperty(null, dataInfo)); source.add(generateStructuredProperty("toBeRejectedBecauseOfNullDataInfo", null)); List<String> results = MetadataConverterUtils.extractValues(source, notNullDataInfoFieldApprover); assertNotNull(results); assertEquals(1, results.size()); assertEquals(validValue, results.get(0)); }</code><technical_language>IDE hint: this substituted FieldApprover notNullDataInfoFieldApprover = Objects::nonNull;</technical_language>

Target:
public void testExtractValues() { FieldApprover notNullDataInfoFieldApprover = Objects::nonNull; DataInfo dataInfo = new DataInfo(); Collection<StructuredProperty> source = Lists.newArrayList(); String validValue = "someValue"; source.add(generateStructuredProperty(validValue, dataInfo)); source.add(generateStructuredProperty(null, dataInfo)); source.add(generateStructuredProperty("", dataInfo)); source.add(generateStructuredProperty("toBeRejectedBecauseOfNullDataInfo", null)); List<String> results = MetadataConverterUtils.extractValues(source, notNullDataInfoFieldApprover); assertNotNull(results); assertEquals(1, results.size()); assertEquals(validValue, results.get(0)); }
Source:
<code>protected T getResultValue(String aResponse) { try { String result = extractValueFromXML(aResponse, getXPathString()); return unmarshal(result); <START> } catch (XPathExpressionException ex) { <END> ex.printStackTrace(); } catch (ParserConfigurationException ex) { ex.printStackTrace(); } catch (SAXException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } return null; }</code><technical_language>of catches a logger statement</technical_language>

Target:
protected T getResultValue(String aResponse) { try { String result = extractValueFromXML(aResponse, getXPathString()); return unmarshal(result); } catch (XPathExpressionException ex) { logger.error("Error parsing XML data.", ex); } catch (ParserConfigurationException ex) { logger.error("Error parsing XML data.", ex); } catch (SAXException ex) { logger.error("Error parsing XML data.", ex); } catch (IOException ex) { logger.error("Error reading XML data.", ex); } return null; }
Source:
<code><START> public Object[] getExpectedResultsForHive() { <END> return new Object[]{ new Integer(1), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000") }; }</code><technical_language>Source of code duplication again! I move expected values a helper class a super class (choice is you)</technical_language>

Target:
public Object[] getExpectedResultsForHive() { return new Object[]{ new Integer(1), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("100"), new BigDecimal("1000000"), new BigDecimal("1000000.05000"), new BigDecimal("1000000"), null }; }
Source:
<code>public long skip(long n) throws IOException { long seek = Math.min(position() + n, totalSize); ensureProperFile(false, seek); <START> return sageFileChannel.skip(n - fileOffsets[currFileIndex]); <END> }</code><technical_language>This right if open a new file, skip byte file start offset. simplify this, call position(seek)</technical_language>

Target:
public long skip(long n) throws IOException { if (n < 0) return 0; long pos = position(); long seek = Math.min(pos + n, totalSize); position(seek); return seek - pos; }