auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>FlatTextInputFormat( @Nullable List<String> columns, @Nullable String listDelimiter, String delimiter, @Nullable Boolean hasHeaderRow, @Nullable Boolean findColumnsFromHeader, int skipHeaderRows ) { this.columns = columns == null ? Collections.emptyList() : columns; this.listDelimiter = listDelimiter; this.delimiter = Preconditions.checkNotNull(delimiter, "delimiter"); if (columns == null || columns.isEmpty()) { this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); } else { this.findColumnsFromHeader = false; } this.skipHeaderRows = skipHeaderRows; Preconditions.checkArgument( !delimiter.equals(listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", delimiter ); if (!this.columns.isEmpty()) { for (String column : this.columns) { <START> Preconditions.checkArgument( <END> !column.contains(delimiter), "Column[%s] cannot have the delimiter[" + delimiter + "] in its name", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }</code><technical_language>this need check for listDelimiter in column names well</technical_language>

Target:
FlatTextInputFormat( @Nullable List<String> columns, @Nullable String listDelimiter, String delimiter, @Nullable Boolean hasHeaderRow, @Nullable Boolean findColumnsFromHeader, int skipHeaderRows ) { this.columns = columns == null ? Collections.emptyList() : columns; this.listDelimiter = listDelimiter; this.delimiter = Preconditions.checkNotNull(delimiter, "delimiter"); if (columns == null || columns.isEmpty()) { this.findColumnsFromHeader = Checks.checkOneNotNullOrEmpty( ImmutableList.of( new Property<>("hasHeaderRow", hasHeaderRow), new Property<>("findColumnsFromHeader", findColumnsFromHeader) ) ).getValue(); } else { this.findColumnsFromHeader = findColumnsFromHeader == null ? false : findColumnsFromHeader; } this.skipHeaderRows = skipHeaderRows; Preconditions.checkArgument( !delimiter.equals(listDelimiter), "Cannot have same delimiter and list delimiter of [%s]", delimiter ); if (!this.columns.isEmpty()) { for (String column : this.columns) { Preconditions.checkArgument( !column.contains(delimiter), "Column[%s] cannot have the delimiter[" + delimiter + "] in its name", column ); } } else { Preconditions.checkArgument( this.findColumnsFromHeader, "If columns field is not set, the first row of your data must have your header" + " and hasHeaderRow must be set to true." ); } }
Source:
<code>public void unload() { super.unload(); <START> httpsInfoTabsPanel.removeAll(); <END> }</code><technical_language>method removed (this statement is required, parent panel is automatically removed). do need remove tabs session is changed? (At status panels behave.)</technical_language>

Target:
public void unload() { super.unload(); }
Source:
<code>static private CharBuffer copyCharBufferData(CharBuffer buffer) { if (!buffer.isDirect() && !buffer.hasArray()) { int pos = buffer.position(); CharBuffer cb = CharBuffer.allocate(buffer.capacity()).put(buffer); cb.position(pos); <START> cb.limit(buffer.limit()); <END> buffer.position(pos); return cb; } return buffer; }</code><technical_language>buffer.remaining() allocating copy buffer. Set cb.position(0) touch cb.limit()</technical_language>

Target:
static private CharBuffer copyCharBufferData(CharBuffer buffer) { if(!buffer.isDirect() && !buffer.hasArray()) { int pos = buffer.position(); CharBuffer cb = CharBuffer.allocate(buffer.remaining()).put(buffer); cb.position(0); buffer.position(pos); return cb; } return buffer; }
Source:
<code>public String convertToDatabaseColumn(DescriptorLanguageSubclass attribute) { <START> if (attribute == null) { <END> return null; } return attribute.getShortName(); }</code><technical_language>get rid of this kind of error prone null checks</technical_language>

Target:
public String convertToDatabaseColumn(DescriptorLanguageSubclass attribute) { return attribute.getShortName(); }
Source:
<code>public static List<Long> getSequencedDishIds(final SQLiteDatabase db) { long b = System.currentTimeMillis(); final Cursor c = db.rawQuery("SELECT dc." + DISH_ID + " FROM " + TABLE_NAME + " dc, " + CategoryTable.TABLE_NAME + " c WHERE dc." + CATEGORY_ID + " = c." + CategoryTable.CATEGORY_ID + " ORDER BY c." + CategoryTable.SORT_ORDER + ", c." + CategoryTable.CATEGORY_ID + ", " + DISH_ID, null); if (c != null) { try { List<Long> list = new ArrayList<Long>(); while (c.moveToNext()) { list.add(c.getLong(c.getColumnIndex(DISH_ID))); } <START> System.out.println("getSequencedDishIds " + (System.currentTimeMillis()-b)); <END> return list; } finally { c.close(); } } return Collections.emptyList(); }</code><technical_language>Remove debug statement, debug log</technical_language>

Target:
public static List<Long> getSequencedDishIds(final SQLiteDatabase db) { final Cursor c = db.rawQuery("SELECT dc." + DISH_ID + " FROM " + TABLE_NAME + " dc, " + CategoryTable.TABLE_NAME + " c WHERE dc." + CATEGORY_ID + " = c." + CategoryTable.CATEGORY_ID + " ORDER BY c." + CategoryTable.SORT_ORDER + ", c." + CategoryTable.CATEGORY_ID + ", " + DISH_ID, null); if (c != null) { try { List<Long> list = new ArrayList<Long>(); while (c.moveToNext()) { list.add(c.getLong(c.getColumnIndex(DISH_ID))); } return list; } finally { c.close(); } } return Collections.emptyList(); }
Source:
<code>static DriverConfigLoader fromClasspath( @NonNull String resourceBaseName, @NonNull ClassLoader appClassLoader) { return new DefaultDriverConfigLoader( () -> { ConfigFactory.invalidateCaches(); Config config = ConfigFactory.defaultOverrides() .withFallback( <START> ConfigFactory.parseResourcesAnySyntax( <END> resourceBaseName, ConfigParseOptions.defaults().setClassLoader(appClassLoader))) .withFallback(ConfigFactory.defaultReference(DRIVER_CLASS_LOADER)) .resolve(); return config.getConfig(DefaultDriverConfigLoader.DEFAULT_ROOT_PATH); }); }</code><technical_language>This is unrelated I improve cache invalidation, done more in cases. I config loader's responsibility invalidate caches, config suppliers'</technical_language>

Target:
static DriverConfigLoader fromClasspath( @NonNull String resourceBaseName, @NonNull ClassLoader appClassLoader) { return new DefaultDriverConfigLoader( () -> { ConfigFactory.invalidateCaches(); Config config = ConfigFactory.defaultOverrides() .withFallback( ConfigFactory.parseResourcesAnySyntax( resourceBaseName, ConfigParseOptions.defaults().setClassLoader(appClassLoader))) .withFallback(ConfigFactory.defaultReference(CqlSession.class.getClassLoader())) .resolve(); return config.getConfig(DefaultDriverConfigLoader.DEFAULT_ROOT_PATH); }); }
Source:
<code>private boolean preDexLibraries(List<File> inputs) { if (mDisableDexMerger || inputs.size() == 1) { return true; } synchronized (semaphore) { final int count = inputs.size(); boolean successful = true; for (int i = 0; i < count && successful; i++) { File input = inputs.get(i); if (input.isFile()) { String fileName = getDexFileName(input); File dexedLib = new File(mDexedLibs, fileName); String dexedLibPath = dexedLib.getAbsolutePath(); if (!dexedLib.isFile() ) { System.out.println( String.format("Pre-Dexing %1$s -> %2$s", input.getAbsolutePath(), fileName)); if (dexedLib.isFile()) { dexedLib.delete(); } <START> successful = runDx(input, dexedLibPath, false); <END> } else { System.out.println( String.format("Using Pre-Dexed %1$s <- %2$s", fileName, input.getAbsolutePath())); } inputs.set(i, dexedLib); } } return successful; } }</code><technical_language>this is escape out of loop next iteration anyway, dexing failed (so line 136 happen), sense return false here</technical_language>

Target:
private boolean preDexLibraries(List<File> inputs) { if (mDisableDexMerger || inputs.size() == 1) { return true; } synchronized (semaphore) { final int count = inputs.size(); for (int i = 0; i < count; i++) { File input = inputs.get(i); if (input.isFile()) { String fileName = getDexFileName(input); File dexedLib = new File(mDexedLibs, fileName); String dexedLibPath = dexedLib.getAbsolutePath(); if (!dexedLib.isFile() ) { System.out.println( String.format("Pre-Dexing %1$s -> %2$s", input.getAbsolutePath(), fileName)); if (dexedLib.isFile()) { dexedLib.delete(); } boolean dexSuccess = runDx(input, dexedLibPath, false); if (!dexSuccess) return false; } else { System.out.println( String.format("Using Pre-Dexed %1$s <- %2$s", fileName, input.getAbsolutePath())); } inputs.set(i, dexedLib); } } return true; } }
Source:
<code>protected void makeFiles(Blob blob, String targetExt) throws CommandNotAvailable, CommandException, IOException { sourceFile = blob.getFile(); String ext = FilenameUtils.getExtension(blob.getFilename()); if (ext == null || "".equals(ext)) { if (sourceFile == null) { sourceFile = createTempSource(blob, "tmp"); } ext = ImageIdentifier.getInfo(sourceFile.getPath()).getFormat(); if (tmpFile == null) { sourceFile = createTempSource(blob, ext); } else { File newTmpFile = new File(FilenameUtils.removeExtension(tmpFile.getPath()) + "." + ext); Files.move(tmpFile.toPath(), newTmpFile.toPath()); tmpFile = newTmpFile; sourceFile = newTmpFile; } } else { if (sourceFile != null && !ext.equals(FilenameUtils.getExtension(sourceFile.getName()))) { sourceFile = null; } } if (sourceFile == null) { sourceFile = createTempSource(blob, ext); } if (targetExt == null) { targetExt = ext; } targetFile = Framework.createTempFile("nuxeoImageTarget", "." + targetExt); Framework.trackFile(targetFile, targetFile); if (tmpFile != null) { <START> Framework.trackFile(tmpFile, tmpFile); <END> } }</code><technical_language>tmpFile is deleted in finally block of call(), need track it</technical_language>

Target:
protected void makeFiles(Blob blob, String targetExt) throws CommandNotAvailable, CommandException, IOException { sourceFile = blob.getFile(); String ext = FilenameUtils.getExtension(blob.getFilename()); if (ext == null || "".equals(ext)) { if (sourceFile == null) { sourceFile = createTempSource(blob, "tmp"); } ext = ImageIdentifier.getInfo(sourceFile.getPath()).getFormat(); if (tmpFile == null) { sourceFile = createTempSource(blob, ext); } else { File newTmpFile = new File(FilenameUtils.removeExtension(tmpFile.getPath()) + "." + ext); Files.move(tmpFile.toPath(), newTmpFile.toPath()); tmpFile = newTmpFile; sourceFile = newTmpFile; } } else { if (sourceFile != null && !ext.equals(FilenameUtils.getExtension(sourceFile.getName()))) { sourceFile = null; } } if (sourceFile == null) { sourceFile = createTempSource(blob, ext); } if (targetExt == null) { targetExt = ext; } targetFile = Framework.createTempFile("nuxeoImageTarget", "." + targetExt); Framework.trackFile(targetFile, targetFile); }
Source:
<code>private Module createSimpleModule(ModuleDescriptor moduleDescriptor, ModuleOptions moduleOptions, ModuleDeploymentProperties deploymentProperties) { if (log.isInfoEnabled()) { log.info("creating simple module " + moduleDescriptor); } ModuleDefinition definition = moduleDescriptor.getModuleDefinition(); ClassLoader moduleClassLoader = (definition.getClasspath() == null) ? null : new ParentLastURLClassLoader(definition.getClasspath(), this.classLoader); <START> Class<? extends SimpleModule> moduleType = determineModuleType(moduleDescriptor.getModuleDefinition()); <END> Assert.notNull(moduleType, String.format("cannot create module '%s:%s' from module definition.", moduleDescriptor.getModuleName(), moduleDescriptor.getType())); return SimpleModuleCreator .newInstance(moduleDescriptor, deploymentProperties, moduleClassLoader, moduleOptions, moduleType); }</code><technical_language>work "type"</technical_language>

Target:
private Module createSimpleModule(ModuleDescriptor moduleDescriptor, ModuleOptions moduleOptions, ModuleDeploymentProperties deploymentProperties) { if (log.isInfoEnabled()) { log.info("creating simple module " + moduleDescriptor); } ModuleDefinition definition = moduleDescriptor.getModuleDefinition(); ClassLoader moduleClassLoader = (definition.getClasspath() == null) ? null : new ParentLastURLClassLoader(definition.getClasspath(), this.parentClassLoader); Class<? extends SimpleModule> moduleClass = determineModuleClass(moduleDescriptor.getModuleDefinition()); Assert.notNull(moduleClass, String.format("cannot create module '%s:%s' from module definition.", moduleDescriptor.getModuleName(), moduleDescriptor.getType())); return SimpleModuleCreator .createModule(moduleDescriptor, deploymentProperties, moduleClassLoader, moduleOptions, moduleClass); }
Source:
<code>public void eventRaised(Event ev, Object sender, EventArgs args) { FrontendFailureEventArgs failureArgs = (FrontendFailureEventArgs) args; if (failureArgs.getMessage() != null) { <START> errorPopupManager.show(ErrorMessageFormatter.formatMessage(failureArgs.getMessage())); <END> } else if (failureArgs.getMessages() != null) { errorPopupManager.show(ErrorMessageFormatter.formatMessages(failureArgs.getMessages())); } }</code><technical_language>this is place CommonApplicationMessages.uiCommonFrontendFailure is - please remove this message CommonApplicationMessages entirely</technical_language>

Target:
public void eventRaised(Event ev, Object sender, EventArgs args) { FrontendFailureEventArgs failureArgs = (FrontendFailureEventArgs) args; if (failureArgs.getMessage() != null) { errorPopupManager.show(MESSAGES.uiCommonRunActionFailed(ErrorMessageFormatter.formatMessage(failureArgs.getMessage()))); } else if (failureArgs.getMessages() != null) { errorPopupManager.show(MESSAGES.uiCommonRunActionFailed(ErrorMessageFormatter.formatMessages(failureArgs.getMessages()))); } }
Source:
<code>public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); Format formatter; ToCharFunction.Type type; switch (dataType) { case DATE: case TIME: <START> case TIMESTAMP: <END> if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = Type.TEMPORAL.getFormatter(formatString); } type = Type.TEMPORAL; break; case DECIMAL: case INTEGER: if (formatString == null) formatString = context.getNumberFormat(); formatter = Type.NUMERIC.getFormatter(formatString); type = Type.NUMERIC; break; default: throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Supported types: DATE, TIMESTAMP, DECIMAL, INTEGER"); } return new ToCharFunction(children, type, formatString, formatter); }</code><technical_language>Instead of a switch type, do a dataType.isCoercibleTo(PDataType.TIMESTAMP), cover for more cases</technical_language>

Target:
public FunctionExpression create(List<Expression> children, StatementContext context) throws SQLException { PDataType dataType = children.get(0).getDataType(); String formatString = (String)((LiteralExpression)children.get(1)).getValue(); Format formatter; ToCharFunction.Type type; if (dataType.isCoercibleTo(PDataType.TIMESTAMP)) { if (formatString == null) { formatString = context.getDateFormat(); formatter = context.getDateFormatter(); } else { formatter = Type.TEMPORAL.getFormatter(formatString); } type = Type.TEMPORAL; } else if (dataType.isCoercibleTo(PDataType.DECIMAL)) { if (formatString == null) formatString = context.getNumberFormat(); formatter = Type.NUMERIC.getFormatter(formatString); type = Type.NUMERIC; } else { throw new SQLException(dataType + " type is unsupported for TO_CHAR(). Numeric and temporal types are supported."); } return new ToCharFunction(children, type, formatString, formatter); }
Source:
<code>public void activate() { try { subscribeKafkaConsumer(); <START> metricsConsumer = new KafkaConsumer<>(kafkaSpoutConfig.getKafkaProps()); <END> } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }</code><technical_language>do need a separate consumer for metric? if need consumers, create this factory. prevent stubbing/spying this consumer</technical_language>

Target:
public void activate() { try { subscribeKafkaConsumer(); } catch (InterruptException e) { throwKafkaConsumerInterruptedException(); } }
Source:
<code>protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } List<VM> vmsDiskPluggedTo = getVmsDiskPluggedTo(); if (vmsDiskPluggedTo != null && !vmsDiskPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } <START> if (!validateCanUpdateDiskInterfaceAndBootable(vmsDiskPluggedTo)) { <END> return false; } } if (shouldResizeDiskImage() && !isImageStatusValid()) { return false; } return validateCanUpdateShareable(); }</code><technical_language>consider spliting methods</technical_language>

Target:
protected boolean canDoAction() { if (!isVmExist() || !isDiskExist(getOldDisk())) { return false; } List<VM> vmsDiskPluggedTo = getVmsDiskPluggedTo(); if (vmsDiskPluggedTo != null && !vmsDiskPluggedTo.isEmpty()) { if (isAtLeastOneVmIsNotDown(vmsDiskPluggedTo) && shouldUpdatePropertiesOtherThanSize()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NOT_DOWN); } boolean isUpdatedAsBootable = !getOldDisk().isBoot() && getNewDisk().isBoot(); if (isUpdatedAsBootable && !validate(noVmsContainBootableDisks(vmsDiskPluggedTo))) { return false; } boolean isDiskInterfaceUpdated = getOldDisk().getDiskInterface() != getNewDisk().getDiskInterface(); if (isDiskInterfaceUpdated && !validatePciAndIdeLimit(vmsDiskPluggedTo)) { return false; } } if (shouldResizeDiskImage() && !validateCanResizeDisk()) { return false; } return validateCanUpdateShareable(); }
Source:
<code>InstalledDriver(K2Context context, Class<? extends StoreDriver> driverClass) throws StoreDriverException { if (context == null) { throw new NullPointerException("context"); } else if (driverClass == null) { throw new NullPointerException("driverClass"); } this.context = context; this.driverClass = driverClass; K2Strings strings = context.getStrings(); if (Modifier.isAbstract(driverClass.getModifiers())) { throw new StoreDriverException(driverClass, <START> strings.get("storage.driver.abstract")); <END> } for (Class<?> cl = driverClass; cl != null; cl = cl.getEnclosingClass()) { if (!Modifier.isPublic(cl.getModifiers())) { throw new StoreDriverException(driverClass, strings.get("storage.driver.nonpublic")); } } try { constructor = driverClass.getConstructor(K2Context.class, URI.class); for (Class<?> exClass : constructor.getExceptionTypes()) { if (!RuntimeException.class.isAssignableFrom(exClass) && !Error.class.isAssignableFrom(exClass) && !IllegalAddressException.class.isAssignableFrom(exClass)) { throw new StoreDriverException(driverClass, strings.get("storage.driver.constructor_throwsbad")); } } } catch (NoSuchMethodException ex) { throw new StoreDriverException(driverClass, strings.get("storage.driver.constructor_missing")); } info = driverClass.getAnnotation(StoreDriverInfo.class); if (info == null) { throw new StoreDriverException(driverClass, strings.get("storage.driver.metadata_missing")); } if (!LEGAL_ID.matcher(info.id()).matches()) { throw new StoreDriverException(driverClass, strings.get("storage.driver.id_illegal")); } }</code><technical_language>I this magic string hash map of strings. This is a land waiting a bug. a minimum this a public static final string of K2Strings? if methods return this string explicitly</technical_language>

Target:
InstalledDriver(K2Context context, Class<? extends StoreDriver> driverClass) throws StoreDriverException { if (context == null) { throw new NullPointerException("context"); } else if (driverClass == null) { throw new NullPointerException("driverClass"); } this.context = context; this.driverClass = driverClass; try { constructor = driverClass.getDeclaredConstructor(); for (Class<?> exClass : constructor.getExceptionTypes()) { if (!RuntimeException.class.isAssignableFrom(exClass) && !Error.class.isAssignableFrom(exClass)) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.ILLEGAL_THROWS); } } constructor.newInstance(); } catch (NoSuchMethodException ex) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.NO_CONSTRUCTOR); } catch (ReflectiveOperationException ex) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.INSTANTIATE_FAIL); } info = driverClass.getAnnotation(StoreDriverInfo.class); if (info == null) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.NO_METADATA); } if (!LEGAL_ID.matcher(info.id()).matches()) { throw new StoreDriverException(driverClass, StoreDriverException.Reason.ILLEGAL_ID); } }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } <START> snapshot = getGlusterVolumeSnapshotDao().getByName(getGlusterVolumeId(), getParameters().getSnapshotName()); <END> if (snapshot == null) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_DOES_NOT_EXIST, getParameters().getSnapshotName()); } return true; }</code><technical_language>call getSnapshot()</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getSnapshot() == null) { failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_SNAPSHOT_DOES_NOT_EXIST, getParameters().getSnapshotName()); } return true; }
Source:
<code>private void onSuccessfulAuth() { Intent i = new Intent(); <START> setResult(RESULT_OK, i); <END> finish(); }</code><technical_language>I is a reason create Intent set in result if put in it</technical_language>

Target:
private void onSuccessfulAuth() { setResult(RESULT_OK); finish(); }
Source:
<code>public void testReplicatesWhenRequiredBySession() { int aRows = 10_000; int bRows = 10_000; assertDetermineSemiJoinDistributionType() <START> .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.BROADCAST.name()) <END> .overrideStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(aRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("A1"), SymbolStatsEstimate.unknown())) .build()) .overrideStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(bRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), SymbolStatsEstimate.unknown())) .build()) .on(p -> p.semiJoin( p.values(new PlanNodeId("valuesA"), aRows, p.symbol("A1", BIGINT)), p.values(new PlanNodeId("valuesB"), bRows, p.symbol("B1", BIGINT)), p.symbol("A1"), p.symbol("B1"), p.symbol("output"), Optional.empty(), Optional.empty(), Optional.empty())) .matches(semiJoin( "A1", "B1", "output", Optional.of(REPLICATED), values(ImmutableMap.of("A1", 0)), values(ImmutableMap.of("B1", 0)))); }</code><technical_language>Set broadcast limit small, BROADCAST is set explicitly, size limit is ignored</technical_language>

Target:
public void testReplicatesWhenRequiredBySession() { int aRows = 10_000; int bRows = 10_000; assertDetermineSemiJoinDistributionType() .setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.BROADCAST.name()) .setSystemProperty(JOIN_MAX_BROADCAST_TABLE_SIZE, "1B") .overrideStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(aRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("A1"), SymbolStatsEstimate.unknown())) .build()) .overrideStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(bRows) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), SymbolStatsEstimate.unknown())) .build()) .on(p -> p.semiJoin( p.values(new PlanNodeId("valuesA"), aRows, p.symbol("A1", BIGINT)), p.values(new PlanNodeId("valuesB"), bRows, p.symbol("B1", BIGINT)), p.symbol("A1"), p.symbol("B1"), p.symbol("output"), Optional.empty(), Optional.empty(), Optional.empty())) .matches(semiJoin( "A1", "B1", "output", Optional.of(REPLICATED), values(ImmutableMap.of("A1", 0)), values(ImmutableMap.of("B1", 0)))); }
Source:
<code>public static boolean isEditableHeader(final ScenarioGridColumn column, final Integer uiHeaderRowIndex) { final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); <START> if (!(headerMetaData instanceof ScenarioHeaderMetaData)) { <END> return false; } final ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) headerMetaData; if (scenarioHeaderMetaData.isEditingMode() || scenarioHeaderMetaData.isReadOnly()) { return false; } if (!column.isInstanceAssigned() || !column.isEditableHeaders()) { return false; } return scenarioHeaderMetaData.isInstanceHeader() || (scenarioHeaderMetaData.isPropertyHeader() && column.isPropertyAssigned()); }</code><technical_language>@jomarko In this case, exception thrown</technical_language>

Target:
public static boolean isEditableHeader(final ScenarioGridColumn column, final Integer uiHeaderRowIndex) { final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex); if (!(headerMetaData instanceof ScenarioHeaderMetaData)) { throw new IllegalStateException("Header metadata has to be an instance of ScenarioHeaderMetaData"); } final ScenarioHeaderMetaData scenarioHeaderMetaData = (ScenarioHeaderMetaData) headerMetaData; if (scenarioHeaderMetaData.isEditingMode() || scenarioHeaderMetaData.isReadOnly()) { return false; } if (!column.isInstanceAssigned() || !column.isEditableHeaders()) { return false; } return scenarioHeaderMetaData.isInstanceHeader() || (scenarioHeaderMetaData.isPropertyHeader() && column.isPropertyAssigned()); }
Source:
<code>public void editCacheContainer() throws Exception { page.treeNavigation() .step("singleton-policy") .step(SINGLETON_POLICY_RESOURCE) .navigateToTreeItem() .clickLabel(); try { new ConfigChecker.Builder(client, SINGLETON_POLICY_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT) .verifyFormSaved() .verifyAttribute(CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT); } catch (NoSuchElementException e) { <START> throw new UnexpectedException("This is failing because of <LINK_0>", e); <END> } }</code><technical_language>IMO java.rmi.UnexpectedException is appropriate. - I suggest instead of "This is failing of ..." write "Possible of element ..." of future error automatically anticipate flaw</technical_language>

Target:
public void editCacheContainer() throws Exception { page.treeNavigation() .step("singleton-policy") .step(SINGLETON_POLICY_RESOURCE) .navigateToTreeItem() .clickLabel(); try { new ConfigChecker.Builder(client, SINGLETON_POLICY_ADDRESS) .configFragment(page.getConfigFragment()) .editAndSave(ConfigChecker.InputType.TEXT, CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT) .verifyFormSaved() .verifyAttribute(CACHE_CONTAINER, CACHE_CONTAINER_RESOURCE_EDIT); } catch (NoSuchElementException e) { throw new IllegalStateException("This is probably failing because of <LINK_0>", e); } }
Source:
<code>static CatalogKey of(final String namespace, final String value) { <START> return Sponge.getRegistry().createKey(namespace, value); <END> }</code><technical_language>builder</technical_language>

Target:
static CatalogKey of(final String namespace, final String value) { return Sponge.getRegistry().createBuilder(Builder.class).namespace(namespace).value(value).build(); }
Source:
<code>private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() { switch ( hcArgs.likelihoodEngineImplementation) { case PairHMM: return new PairHMMLikelihoodCalculationEngine((byte) hcArgs.likelihoodArgs.gcpHMM, hcArgs.likelihoodArgs.pairHMM, log10GlobalReadMismappingRate, hcArgs.pcrErrorModel); case Random: return new RandomLikelihoodCalculationEngine(); default: throw new UserException("Unsupported likelihood calculation engine '" + likelihoodCalculationEngine + <START> "'. Please use one of the following instead: 'PairHMM' or 'GraphBased'."); <END> } }</code><technical_language>GraphBased is</technical_language>

Target:
private ReadLikelihoodCalculationEngine createLikelihoodCalculationEngine() { switch ( hcArgs.likelihoodEngineImplementation) { case PairHMM: return new PairHMMLikelihoodCalculationEngine((byte) hcArgs.likelihoodArgs.gcpHMM, hcArgs.likelihoodArgs.pairHMM, log10GlobalReadMismappingRate, hcArgs.pcrErrorModel); case Random: return new RandomLikelihoodCalculationEngine(); default: throw new UserException("Unsupported likelihood calculation engine: " + likelihoodCalculationEngine); } }
Source:
<code>private static void marshalFiles( WritableChannel buffer, File[] files ) throws IOException { buffer.putInt( files.length ); for ( File file : files ) { <START> byte[] bytes = file.getName().getBytes(); <END> buffer.putInt( bytes.length ); buffer.put( bytes, bytes.length ); } }</code><technical_language>Give getBytes a Charset, for instance StandardCharsets.UTF_8, avoid platform encoding dictating this produces</technical_language>

Target:
private static void marshalFiles( WritableChannel buffer, File[] files ) throws IOException { buffer.putInt( files.length ); for ( File file : files ) { putBytes( buffer, file.getName() ); } }
Source:
<code>public CharSeq repeat(int times) { if (times <= 0) return empty(); else if (times == 1) return this; else { final int finalLength = length() * times; final StringBuilder result = new StringBuilder(2 * finalLength); result.append(back); for (int i = 1; i <= times; i *= 2) { result.append(result); } <START> result.setLength(finalLength); <END> return of(result); } }</code><technical_language>Nice solution! Guava arrays instead of a StringBuilder. Guava's size check array copy (to save mem) nice: <LINK_0> do think, give a try 'Guava way'</technical_language>

Target:
public CharSeq repeat(int times) { if (times <= 0 || isEmpty()) return empty(); else if (times == 1) return this; else { final int finalLength = length() * times; final char[] result = new char[finalLength]; back.getChars(0, length(), result, 0); int i = length(); for (; i <= (finalLength >>> 1); i <<= 1) { System.arraycopy(result, 0, result, i, i); } System.arraycopy(result, 0, result, i, finalLength - i); return of(new String(result)); } }
Source:
<code>protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, ImmutableList<String> nodeArguments, ImmutableMap<String, String> nodeEnvironment) { try { return new AppiumDriverLocalService(ipAddress, nodeJSExecutable, nodeJSPort, nodeArguments, nodeEnvironment, <START> timeToWaitForAppiumNodeIsStarted, timeUnitToWaitForAppiumNodeIsStarted); <END> } catch (IOException e) { throw new RuntimeException(e); } }</code><technical_language>naming excessively verbose. timeToWaitForAppiumNodeIsStarted, timeUnitToWaitForAppiumNodeIsStarted shorter as: startupTimeout, timeUnit</technical_language>

Target:
protected AppiumDriverLocalService createDriverService(File nodeJSExecutable, int nodeJSPort, ImmutableList<String> nodeArguments, ImmutableMap<String, String> nodeEnvironment) { try { return new AppiumDriverLocalService(ipAddress, nodeJSExecutable, nodeJSPort, nodeArguments, nodeEnvironment, startupTimeout, timeUnit); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
<code>public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); <START> TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null)); <END> }</code><technical_language>If this method is executed in non-UI thread receiving components thread access problems. (org.eclipse.swt.SWTException: Invalid thread access). In internal plug-in this problem timezone a request handling</technical_language>

Target:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); }
Source:
<code>public State as(Class<? extends State> target) { if (target == OnOffType.class) { return equals(ZERO) ? OnOffType.OFF : OnOffType.ON; } else if (target == PercentType.class) { return new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return UpDownType.UP; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return UpDownType.DOWN; } else { return UnDefType.UNDEF; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return OpenClosedType.CLOSED; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return OpenClosedType.OPEN; } else { return UnDefType.UNDEF; } } else if (target == HSBType.class) { return new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else { <START> return State.super.as(target); <END> } }</code><technical_language>brand-new method to</technical_language>

Target:
public State as(Class<? extends State> target) { if (target == OnOffType.class) { return equals(ZERO) ? OnOffType.OFF : OnOffType.ON; } else if (target == PercentType.class) { return new PercentType(toBigDecimal().multiply(BigDecimal.valueOf(100))); } else if (target == UpDownType.class) { if (equals(ZERO)) { return UpDownType.UP; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return UpDownType.DOWN; } else { return UnDefType.UNDEF; } } else if (target == OpenClosedType.class) { if (equals(ZERO)) { return OpenClosedType.CLOSED; } else if (toBigDecimal().compareTo(BigDecimal.valueOf(1)) == 0) { return OpenClosedType.OPEN; } else { return UnDefType.UNDEF; } } else if (target == HSBType.class) { return new HSBType(DecimalType.ZERO, PercentType.ZERO, new PercentType(this.toBigDecimal().multiply(BigDecimal.valueOf(100)))); } else { return defaultConversion(target); } }
Source:
<code>private ServiceReference getTransformerServiceReference(String transformerId) throws CatalogTransformerException { return metacardTransformers .stream() .filter(serviceRef -> serviceRef.getProperty("id") != null) <START> .filter(serviceRef -> serviceRef.getProperty("id").toString().equals(transformerId)) <END> .findFirst() .orElseThrow( () -> new CatalogTransformerException( "The metacard transformer with ID " + transformerId + " could not be found.")); }</code><technical_language>combine filter steps: .filter(serviceRef -> serviceRef.getProperty("id") != null) .filter(serviceRef -> serviceRef.getProperty("id").toString().equals(transformerId)) .filter(serviceRef -> transformerId.equals(serviceRef.getProperty("id")))</technical_language>

Target:
private ServiceReference getTransformerServiceReference(String transformerId) throws CatalogTransformerException { return metacardTransformers .stream() .filter(serviceRef -> transformerId.equals(serviceRef.getProperty("id"))) .findFirst() .orElseThrow( () -> new CatalogTransformerException( "The metacard transformer with ID " + transformerId + " could not be found.")); }
Source:
<code>public synchronized void close() <START> throws IOException <END> { if (!deleted) { Files.delete(filePath); deleted = true; } }</code><technical_language>I this code needs throws</technical_language>

Target:
public synchronized void close() { if (deleted) { return; } deleted = true; try { Files.delete(filePath); } catch (IOException e) { throw new UncheckedIOException(e); } }
Source:
<code>public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); Map<String, String> attributes = this.getAttributes(); if (attributes != null) { <START> copy.setAttributes(new HashMap<String, String>(attributes)); <END> } return copy; }</code><technical_language>This is unnecessary encapsulation issue is resolved</technical_language>

Target:
public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); copy.setAttributes(this.getAttributes()); return copy; }
Source:
<code>public static VMImage decodeFieldsFromUniqueId(final String id) { VMImage vmImage; String[] fields = checkNotNull(id, "id").split("/"); <START> boolean custom = fields.length == 5; <END> if (custom) { vmImage = VMImage.customImage().location(fields[0]).group(fields[1]).storage(fields[2]).vhd1(fields[3]) .offer(fields[4]).build(); } else { vmImage = VMImage.azureImage().location(fields[0]).publisher(fields[1]).offer(fields[2]).sku(fields[3]) .build(); } return vmImage; }</code><technical_language>Change this a public static function called adapter, instead of duplicating this logic there</technical_language>

Target:
public static VMImage decodeFieldsFromUniqueId(final String id) { VMImage vmImage; String[] fields = checkNotNull(id, "id").split("/"); if (isCustom(id)) { vmImage = VMImage.customImage().location(fields[0]).group(fields[1]).storage(fields[2]).vhd1(fields[3]) .offer(fields[4]).build(); } else { vmImage = VMImage.azureImage().location(fields[0]).publisher(fields[1]).offer(fields[2]).sku(fields[3]) .build(); } return vmImage; }
Source:
<code>private List<IBinding> filterClassScopeBindings(ICPPClassType classType, IBinding[] bindings, final boolean isDeclaration) { List<IBinding> filtered = new ArrayList<IBinding>(); final boolean canBeFieldAccess = canBeFieldAccess(classType); <START> final IBinding templateInstance = (classType instanceof ICPPTemplateInstance) <END> ? ((ICPPTemplateInstance) classType).getTemplateDefinition() : null; for (final IBinding binding : bindings) { if (binding instanceof IField) { IField field = (IField) binding; if (!canBeFieldAccess && !field.isStatic()) continue; } else if (binding instanceof ICPPMethod) { ICPPMethod method = (ICPPMethod) binding; if (method.isImplicit()) continue; if (!isDeclaration) { if (method.isDestructor() || method instanceof ICPPConstructor || (!canBeFieldAccess && !method.isStatic())) continue; } } else if (binding instanceof IEnumerator || binding instanceof IEnumeration) { if (isDeclaration) continue; } else if (templateInstance == binding) { continue; } else if (binding instanceof IType) { if (classType.isSameType((IType) binding)) continue; } filtered.add(binding); } return filtered; }</code><technical_language>name of variable is misleading variable a template instance</technical_language>

Target:
private List<IBinding> filterClassScopeBindings(ICPPClassType classType, IBinding[] bindings, final boolean isDeclaration) { List<IBinding> filtered = new ArrayList<IBinding>(); final boolean canBeFieldAccess = canBeFieldAccess(classType); final IBinding templateDefinition = (classType instanceof ICPPTemplateInstance) ? ((ICPPTemplateInstance) classType).getTemplateDefinition() : null; for (final IBinding binding : bindings) { if (binding instanceof IField) { IField field = (IField) binding; if (!canBeFieldAccess && !field.isStatic()) continue; } else if (binding instanceof ICPPMethod) { ICPPMethod method = (ICPPMethod) binding; if (method.isImplicit()) continue; if (!isDeclaration) { if (method.isDestructor() || method instanceof ICPPConstructor || (!canBeFieldAccess && !method.isStatic())) continue; } } else if (binding instanceof IEnumerator || binding instanceof IEnumeration) { if (isDeclaration) continue; } else if (templateDefinition == binding) { continue; } else if (binding instanceof IType) { if (classType.isSameType((IType) binding)) continue; } filtered.add(binding); } return filtered; }
Source:
<code>public List<Resource> getAssignedResources(PerunSession sess, Service service) throws InternalErrorException, PrivilegeException, ServiceNotExistsException { Utils.checkPerunSession(sess); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN) && !AuthzResolver.isAuthorized(sess, Role.ENGINE) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER) && !AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { throw new PrivilegeException(sess, "getAssignedResources"); } <START> <END> getServicesManagerBl().checkServiceExists(sess, service); return getServicesManagerBl().getAssignedResources(sess, service); }</code><technical_language>I add filtering for returned resources for VOADMIN VOOBSERVER role. get resources of other VOs, service assigned. part of this pull-request thought. create new pull-request this specific change</technical_language>

Target:
public List<Resource> getAssignedResources(PerunSession sess, Service service) throws InternalErrorException, PrivilegeException, ServiceNotExistsException { Utils.checkPerunSession(sess); getServicesManagerBl().checkServiceExists(sess, service); List<Resource> resources = getServicesManagerBl().getAssignedResources(sess, service); if (AuthzResolver.isAuthorized(sess, Role.ENGINE) || AuthzResolver.isAuthorized(sess, Role.PERUNOBSERVER)) { return resources; } if (AuthzResolver.isAuthorized(sess, Role.VOADMIN) || AuthzResolver.isAuthorized(sess, Role.VOOBSERVER)) { Iterator<Resource> iterator = resources.iterator(); while (iterator.hasNext()) { Resource resource = iterator.next(); if (!AuthzResolver.isAuthorized(sess, Role.VOADMIN, resource) && !AuthzResolver.isAuthorized(sess, Role.VOOBSERVER, resource)) { iterator.remove(); } } } else { throw new PrivilegeException(sess, "getAssignedResources"); } return resources; }
Source:
<code>public void testModuleGroups() throws Exception { Map<String, String> results = new HashMap<>(); results.put(QuboleConstant.BIGDATALAUNCHER_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.PIG_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.S3_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.PIG_PARQUET_MODULE_GROUP.getModuleName(), "(LOAD=='PARQUETLOADER') OR (STORE=='PARQUETSTORER')"); results.put(QuboleConstant.PIG_AVRO_MODULE_GROUP.getModuleName(), "(LOAD=='AVROSTORAGE') OR (STORE=='AVROSTORAGE')"); results.put(QuboleConstant.PIG_SEQUENCEFILE_MODULE_GROUP.getModuleName(), "(LOAD=='SEQUENCEFILELOADER') OR (STORE=='SEQUENCEFILESTORAGE')"); results.put(QuboleConstant.PIG_RCFILE_MODULE_GROUP.getModuleName(), "(LOAD=='RCFILEPIGSTORAGE') OR (STORE=='RCFILEPIGSTORAGE')"); Set<DistributionModuleGroup> moduleGroups = QubolePigModuleGroup.getModuleGroups(); assertEquals(7, moduleGroups.size()); for (DistributionModuleGroup module : moduleGroups) { assertTrue("Should contain module " + module.getModuleName(), results.containsKey(module.getModuleName())); <START> if (results.get(module.getModuleName()) == null) { <END> assertTrue("The condition of the module " + module.getModuleName() + " is not null.", results.get(module.getModuleName()) == null); } else { assertTrue("The condition of the module " + module.getModuleName() + " is null, but it should be " + results.get(module.getModuleName()) + ".", results.get(module.getModuleName()) != null); assertEquals(results.get(module.getModuleName()), module.getRequiredIf().getConditionString()); } } }</code><technical_language>above, I misunderstand</technical_language>

Target:
public void testModuleGroups() throws Exception { Map<String, String> results = new HashMap<>(); results.put(QuboleConstant.BIGDATALAUNCHER_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.PIG_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.S3_MODULE_GROUP.getModuleName(), null); results.put(QuboleConstant.PIG_PARQUET_MODULE_GROUP.getModuleName(), "(LOAD=='PARQUETLOADER') OR (STORE=='PARQUETSTORER')"); results.put(QuboleConstant.PIG_AVRO_MODULE_GROUP.getModuleName(), "(LOAD=='AVROSTORAGE') OR (STORE=='AVROSTORAGE')"); results.put(QuboleConstant.PIG_SEQUENCEFILE_MODULE_GROUP.getModuleName(), "(LOAD=='SEQUENCEFILELOADER') OR (STORE=='SEQUENCEFILESTORAGE')"); results.put(QuboleConstant.PIG_RCFILE_MODULE_GROUP.getModuleName(), "(LOAD=='RCFILEPIGSTORAGE') OR (STORE=='RCFILEPIGSTORAGE')"); Set<DistributionModuleGroup> moduleGroups = QubolePigModuleGroup.getModuleGroups(); assertEquals(7, moduleGroups.size()); for (DistributionModuleGroup group : moduleGroups) { assertEquals(results.get(group.getModuleName()), group.getRequiredIf() == null ? null : group.getRequiredIf().getConditionString()); } }
Source:
<code>public static byte[] encode(PasswordSpec passwordSpec) throws NoSuchAlgorithmException, InvalidKeySpecException { <START> if (ClearPasswordSpec.class.isInstance(passwordSpec)) { <END> return encodeClearPasswordSpec((ClearPasswordSpec) passwordSpec); } else if (DigestPasswordSpec.class.isInstance(passwordSpec)) { return encodeDigestPasswordSpec((DigestPasswordSpec) passwordSpec); } else if (SaltedHashPasswordSpec.class.isInstance(passwordSpec)) { return encodeSaltedHashPasswordSpec((SaltedHashPasswordSpec) passwordSpec); } else if (IteratedSaltedHashPasswordSpec.class.isInstance(passwordSpec)) { return encodeIteratedSaltedHashSpec((IteratedSaltedHashPasswordSpec) passwordSpec); } else if (HashPasswordSpec.class.isInstance(passwordSpec)) { return encodeHashPasswordSpec((HashPasswordSpec) passwordSpec); } return null; }</code><technical_language>instanceof checks</technical_language>

Target:
public static byte[] encode(PasswordSpec passwordSpec) throws NoSuchAlgorithmException, InvalidKeySpecException { if (passwordSpec instanceof ClearPasswordSpec) { return encodeClearPasswordSpec((ClearPasswordSpec) passwordSpec); } else if (passwordSpec instanceof DigestPasswordSpec) { return encodeDigestPasswordSpec((DigestPasswordSpec) passwordSpec); } else if (passwordSpec instanceof SaltedHashPasswordSpec) { return encodeSaltedHashPasswordSpec((SaltedHashPasswordSpec) passwordSpec); } else if (passwordSpec instanceof IteratedSaltedHashPasswordSpec) { return encodeIteratedSaltedHashSpec((IteratedSaltedHashPasswordSpec) passwordSpec); } else if (passwordSpec instanceof HashPasswordSpec) { return encodeHashPasswordSpec((HashPasswordSpec) passwordSpec); } return null; }
Source:
<code>private PGPSecretKey attemptParseSecretKey(Path keyFile, PGPDigestCalculatorProvider calculatorProvider, PBEProtectionRemoverFactory passphraseProvider, PGPPublicKey publicKey) { try (InputStream in = newInputStream(keyFile)) { return new SExprParser(calculatorProvider).parseSecretKey( new BufferedInputStream(in), passphraseProvider, publicKey); } catch (IOException | PGPException | ClassCastException e) { <START> return null; <END> } }</code><technical_language>log failure</technical_language>

Target:
private PGPSecretKey attemptParseSecretKey(Path keyFile, PGPDigestCalculatorProvider calculatorProvider, PBEProtectionRemoverFactory passphraseProvider, PGPPublicKey publicKey) { try (InputStream in = newInputStream(keyFile)) { return new SExprParser(calculatorProvider).parseSecretKey( new BufferedInputStream(in), passphraseProvider, publicKey); } catch (IOException | PGPException | ClassCastException e) { if (log.isDebugEnabled()) log.debug("Ignoring unreadable file '{}': {}", keyFile, e.getMessage(), e); return null; } }
Source:
<code>public int countOfComponents() { <START> return pcxi[0].length; <END> }</code><technical_language>I guess if partition is empty this row throws IndexOutOfBoundsException</technical_language>

Target:
public int countOfComponents() { return size() != 0 ? pcxi[0].length : 0; }
Source:
<code>protected Plan getTestJob() { Plan plan = getPlan(1 , textPath, resultPath); try { plan.registerCachedFile(cachePath, "cache_test"); } catch (IOException ex) { <START> ex.printStackTrace(); <END> } return plan; }</code><technical_language>Mhhh .. nice ;) fail test in case? rethrow exception</technical_language>

Target:
protected Plan getTestJob() { Plan plan = getPlan(1 , textPath, resultPath); try { plan.registerCachedFile(cachePath, "cache_test"); } catch (IOException ex) { throw new RuntimeException(ex); } return plan; }
Source:
<code><START> public void clickingCancel_shouldDismissTheDialog() { <END> dialogFragment.show(fragmentManager, "tag"); AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); assertTrue(dialog.isShowing()); dialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick(); assertFalse(dialog.isShowing()); assertTrue(shadowOf(dialog).hasBeenDismissed()); }</code><technical_language>Do feel need this test? Happy talk some more</technical_language>

Target:
public void clickingCancel_shouldDismissTheDialog() { dialogFragment.show(fragmentManager, "tag"); AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); assertTrue(dialog.isShowing()); dialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick(); assertFalse(dialog.isShowing()); assertTrue(shadowOf(dialog).hasBeenDismissed()); }