auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForDisk(DiskImage disk, Guid containerID) { Guid originalDiskId = newDiskIdForDisk.get(disk.getId()).getId(); Guid destinationDomain = imageToDestinationDomainMap.get(originalDiskId); MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, originalDiskId, newDiskIdForDisk.get(disk.getId()).getImageId(), disk.getId(), disk.getImageId(), destinationDomain, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setUseCopyCollapse(getParameters().getCopyCollapse()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setRevertDbOperationScope(ImageDbOperationScope.IMAGE); params.setQuotaId(disk.getQuotaId() != null ? disk.getQuotaId() : getParameters().getQuotaId()); params.setDiskProfileId(getParameters().getDiskProfileId()); if (getParameters().getVm().getDiskMap() != null && getParameters().getVm().getDiskMap().containsKey(originalDiskId)) { DiskImageBase diskImageBase = (DiskImageBase) getParameters().getVm().getDiskMap().get(originalDiskId); params.setVolumeType(diskImageBase.getVolumeType()); params.setVolumeFormat(diskImageBase.getVolumeFormat()); } params.setParentParameters(getParameters()); return params; }

Target:
private MoveOrCopyImageGroupParameters buildMoveOrCopyImageGroupParametersForDisk(DiskImage disk, Guid containerID) { Guid originalDiskId = newDiskIdForDisk.get(disk.getId()).getId(); Guid destinationDomain = imageToDestinationDomainMap.get(originalDiskId); MoveOrCopyImageGroupParameters params = new MoveOrCopyImageGroupParameters(containerID, originalDiskId, newDiskIdForDisk.get(disk.getId()).getImageId(), disk.getId(), disk.getImageId(), destinationDomain, getMoveOrCopyImageOperation()); params.setParentCommand(getActionType()); params.setUseCopyCollapse(getParameters().getCopyCollapse()); params.setCopyVolumeType(CopyVolumeType.LeafVol); params.setForceOverride(getParameters().getForceOverride()); params.setSourceDomainId(getParameters().getSourceDomainId()); params.setStoragePoolId(getParameters().getStoragePoolId()); params.setImportEntity(true); params.setEntityInfo(new EntityInfo(VdcObjectType.VM, getVm().getId())); params.setRevertDbOperationScope(ImageDbOperationScope.IMAGE); params.setQuotaId(disk.getQuotaId() != null ? disk.getQuotaId() : getParameters().getQuotaId()); params.setDiskProfileId(disk.getDiskProfileId()); if (getParameters().getVm().getDiskMap() != null && getParameters().getVm().getDiskMap().containsKey(originalDiskId)) { DiskImageBase diskImageBase = (DiskImageBase) getParameters().getVm().getDiskMap().get(originalDiskId); params.setVolumeType(diskImageBase.getVolumeType()); params.setVolumeFormat(diskImageBase.getVolumeFormat()); } params.setParentParameters(getParameters()); return params; }
Source:
public void initVerifier(SessionContext session, PublicKey key) throws Exception { if (!(key instanceof SecurityKeyPublicKey)) { throw new IllegalArgumentException("Only instances of SecurityKeyPublicKey can be used"); } this.publicKey = (SecurityKeyPublicKey) key; this.challengeDigest = MessageDigest.getInstance("SHA-256"); }

Target:
public void initVerifier(SessionContext session, PublicKey key) throws GeneralSecurityException { if (!(key instanceof SecurityKeyPublicKey)) { throw new IllegalArgumentException("Only instances of SecurityKeyPublicKey can be used"); } this.publicKey = (SecurityKeyPublicKey) key; this.challengeDigest = SecurityUtils.getMessageDigest("SHA-256"); }
Source:
public Flux<ServiceMessage> invokeBidirectional(Publisher<ServiceMessage> publisher) { return Flux.from(publisher) .switchOnFirst( (first, messages) -> { if (first.hasValue()) { return authenticate(first.get()) .flatMapMany( principal -> messages .map(this::toRequest) .transform(request -> invoke(request, principal))) .map(this::toResponse); } else { return messages .map(this::toRequest) .transform(request -> invoke(request, null)) .map(this::toResponse); } }) .onErrorResume(throwable -> Flux.just(errorMapper.toMessage(throwable))); }

Target:
public Flux<ServiceMessage> invokeBidirectional(Publisher<ServiceMessage> publisher) { return Flux.from(publisher) .switchOnFirst( (first, messages) -> authenticate(first.get()) .flatMapMany( principal -> messages .map(this::toRequest) .transform(request -> invoke(request, principal)))) .map(this::toResponse) .onErrorResume(throwable -> Flux.just(errorMapper.toMessage(throwable))); }
Source:
private void invokeStartShellDialog( ConsoleProcess.TerminalType terminalType, boolean isModalDialog, int cols, int rows, String terminalHandle, String terminalTitle, int sequence, ServerRequestCallback<ConsoleProcess> requestCallback) { JSONArray params = new JSONArray(); params.set(0, new JSONString(terminalType.toString())); params.set(1, new JSONNumber(cols)); params.set(2, new JSONNumber(rows)); params.set(3, JSONBoolean.getInstance(isModalDialog)); params.set(4, new JSONString(terminalHandle == null ? "" : terminalHandle)); params.set(5, new JSONString(terminalTitle == null ? "" : terminalTitle)); params.set(6, new JSONNumber(sequence)); sendRequest(RPC_SCOPE, START_SHELL_DIALOG, params, new ConsoleProcessCallbackAdapter(requestCallback)); }

Target:
private void invokeStartShellDialog( ConsoleProcess.TerminalType terminalType, boolean isModalDialog, int cols, int rows, String terminalHandle, String terminalTitle, int sequence, ServerRequestCallback<ConsoleProcess> requestCallback) { JSONArray params = new JSONArray(); params.set(0, new JSONString(terminalType.toString())); params.set(1, new JSONNumber(cols)); params.set(2, new JSONNumber(rows)); params.set(3, JSONBoolean.getInstance(isModalDialog)); params.set(4, new JSONString(StringUtil.notNull(terminalHandle))); params.set(5, new JSONString(StringUtil.notNull(terminalTitle))); params.set(6, new JSONNumber(sequence)); sendRequest(RPC_SCOPE, START_SHELL_DIALOG, params, new ConsoleProcessCallbackAdapter(requestCallback)); }
Source:
protected boolean isInterfaceSupportedForPlugUnPlug(Disk disk) { boolean retVal = true; List<String> diskHotpluggableInterfaces = osRepository.getDiskHotpluggableInterfaces(getVm().getOs(), getVm().getVdsGroupCompatibilityVersion()); if (diskHotpluggableInterfaces == null || diskHotpluggableInterfaces.isEmpty()) { retVal = false; } if (retVal) { Collection<DiskInterface> diskInterfaces = new HashSet<DiskInterface>(); for (String diskHotpluggableInterface : diskHotpluggableInterfaces) { diskInterfaces.add(DiskInterface.valueOf(diskHotpluggableInterface)); } if (!diskInterfaces.contains(disk.getDiskInterface())) { retVal = false; } } if (!retVal) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return retVal; }

Target:
protected boolean isInterfaceSupportedForPlugUnPlug(Disk disk) { List<String> diskHotpluggableInterfaces = osRepository.getDiskHotpluggableInterfaces(getVm().getOs(), getVm().getVdsGroupCompatibilityVersion()); if (CollectionUtils.isEmpty(diskHotpluggableInterfaces)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } Collection<DiskInterface> diskInterfaces = new HashSet<DiskInterface>(); for (String diskHotpluggableInterface : diskHotpluggableInterfaces) { diskInterfaces.add(DiskInterface.valueOf(diskHotpluggableInterface)); } if (!diskInterfaces.contains(disk.getDiskInterface())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GUEST_OS_VERSION_IS_NOT_SUPPORTED); } return true; }
Source:
public long timestampForDate(String date) { long timeStamp = 0; SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); try { timeStamp = sdf.parse(date).getTime(); if (!timestampHasMilliseconds) { timeStamp = timeStamp / 1000L; } } catch (ParseException e) { e.printStackTrace(); } return timeStamp; }

Target:
public long timestampForDate(String date) { Date parsedDate = parseDate(date); return timestampForDate(parsedDate); }
Source:
protected String getJVMJobTypeParameters() { String args = ""; String typeUserGlobalJVMArgs = getJobProps().getString(HadoopJobUtils.JOBTYPE_GLOBAL_JVM_ARGS, null); if (typeUserGlobalJVMArgs != null) { args += " " + typeUserGlobalJVMArgs; } String typeSysGlobalJVMArgs = getSysProps().getString(HadoopJobUtils.JOBTYPE_GLOBAL_JVM_ARGS, null); if (typeSysGlobalJVMArgs != null) { args += " " + typeSysGlobalJVMArgs; } String typeUserJVMArgs = getJobProps().getString(HadoopJobUtils.JOBTYPE_JVM_ARGS, null); if (typeUserJVMArgs != null) { args += " " + typeUserJVMArgs; } String typeSysJVMArgs = getSysProps().getString(HadoopJobUtils.JOBTYPE_JVM_ARGS, null); if (typeSysJVMArgs != null) { args += " " + typeSysJVMArgs; } return args; }

Target:
protected String getJVMJobTypeParameters() { String args = ""; String jobTypeUserGlobalJVMArgs = getJobProps().getString(HadoopJobUtils.JOBTYPE_GLOBAL_JVM_ARGS, null); if (jobTypeUserGlobalJVMArgs != null) { args += " " + jobTypeUserGlobalJVMArgs; } String jobTypeSysGlobalJVMArgs = getSysProps().getString(HadoopJobUtils.JOBTYPE_GLOBAL_JVM_ARGS, null); if (jobTypeSysGlobalJVMArgs != null) { args += " " + jobTypeSysGlobalJVMArgs; } String jobTypeUserJVMArgs = getJobProps().getString(HadoopJobUtils.JOBTYPE_JVM_ARGS, null); if (jobTypeUserJVMArgs != null) { args += " " + jobTypeUserJVMArgs; } String jobTypeSysJVMArgs = getSysProps().getString(HadoopJobUtils.JOBTYPE_JVM_ARGS, null); if (jobTypeSysJVMArgs != null) { args += " " + jobTypeSysJVMArgs; } return args; }
Source:
private TerminationTreeItemContent createTerminationTreeItemContent( TerminationConfigOption terminationConfigOption, TreeItem treeItem, TerminationConfigModel terminationConfigModel ) { TerminationTreeItemContent terminationTreeItemContent = IOC.getBeanManager().lookupBean( TerminationTreeItemContent.class ).newInstance(); terminationTreeItemContent.setTerminationConfigForm( this ); terminationTreeItemContent.setTerminationConfigOption( terminationConfigOption ); terminationTreeItemContent.setTreeItem( treeItem ); terminationTreeItemContent.setModel( terminationConfigModel ); treeItem.setUserObject( terminationTreeItemContent ); treeItem.setWidget( terminationTreeItemContent.asWidget() ); treeItem.setState( true ); return terminationTreeItemContent; }

Target:
private TerminationTreeItemContent createTerminationTreeItemContent( TerminationConfigOption terminationConfigOption, TreeItem treeItem, TerminationConfigModel terminationConfigModel ) { TerminationTreeItemContent terminationTreeItemContent = beanManager.lookupBean( TerminationTreeItemContent.class ).newInstance(); terminationTreeItemContent.setTerminationConfigForm( this ); terminationTreeItemContent.setTerminationConfigOption( terminationConfigOption ); terminationTreeItemContent.setTreeItem( treeItem ); terminationTreeItemContent.setModel( terminationConfigModel ); treeItem.setUserObject( terminationTreeItemContent ); treeItem.setWidget( ElementWrapperWidget.getWidget( terminationTreeItemContent.getElement() ) ); treeItem.setState( true ); terminationTreeItemContentList.add( terminationTreeItemContent ); return terminationTreeItemContent; }
Source:
public StatemachineHeader get() { StatemachineHeader source = new StatemachineHeader(); injector.injectMembers(source); GeneratorEntry entry = injector.getInstance(GeneratorEntry.class); if (isEventDriven(entry)) { source.getContentProviders().add(injector.getInstance(EventDrivenStatemachineHeaderFragment.class)); } source.getContentProviders().add(injector.getInstance(StatemachineHeaderContentFragment.class)); return source; }

Target:
public StatemachineHeader get() { StatemachineHeader header = new StatemachineHeader(); injector.injectMembers(header); if (isEventDriven()) { header.getContentProviders().add(injector.getInstance(EventDrivenStatemachineHeaderFragment.class)); } header.getContentProviders().add(injector.getInstance(StatemachineHeaderContentFragment.class)); return header; }
Source:
public List<User> getUsers(String name, List<Role> roles, boolean includeRetired, Integer start, Integer length) throws APIException { if (name != null) { name = StringUtils.replace(name,", ", " "); } if (roles == null) { return dao.getUsers(name, new ArrayList<Role>(new HashSet<>()), includeRetired, start, length); } else if(roles.contains(getRole(RoleConstants.AUTHENTICATED))){ return dao.getUsers(name, new ArrayList<>(), includeRetired, start, length); } else{ Set<Role> allRoles = new HashSet<>(); for (Role r : roles) { allRoles.add(r); allRoles.addAll(r.getAllChildRoles()); } return dao.getUsers(name, new ArrayList<>(allRoles), includeRetired, start, length); } }

Target:
public List<User> getUsers(String name, List<Role> roles, boolean includeRetired, Integer start, Integer length) throws APIException { if (name != null) { name = StringUtils.replace(name,", ", " "); } if (roles == null) { roles = new ArrayList<>(); } Role authRole = getRole(RoleConstants.AUTHENTICATED); if (roles.contains(authRole)) { return dao.getUsers(name, new ArrayList<>(), includeRetired, start, length); } Set<Role> allRoles = new HashSet<>(); for (Role r : roles) { allRoles.add(r); allRoles.addAll(r.getAllChildRoles()); } return dao.getUsers(name, new ArrayList<>(allRoles), includeRetired, start, length); }
Source:
private void searchTest(String searchFor, int expectedResults, String ... expectedIds) { PoolFilterBuilder filters = new PoolFilterBuilder(); filters.addContainsTextFilter(searchFor); Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools( null, owner, null, null, false, filters, req, false); List<Pool> results = page.getPageData(); assertEquals(expectedResults, results.size()); for (String id : expectedIds) { boolean found = false; for (Pool p : results) { if (p.getId().equals(id)) { found = true; continue; } } assertTrue("Missing expected pool: " + id, found); } }

Target:
private void searchTest(String searchFor, int expectedResults, String ... expectedIds) { PoolFilterBuilder filters = new PoolFilterBuilder(); filters.addContainsTextFilter(searchFor); Page<List<Pool>> page = poolCurator.listAvailableEntitlementPools( null, owner, null, null, false, filters, req, false); List<Pool> results = page.getPageData(); assertEquals(expectedResults, results.size()); for (String id : expectedIds) { boolean found = false; for (Pool p : results) { if (p.getId().equals(id)) { found = true; break; } } assertTrue("Missing expected pool: " + id, found); } }
Source:
private void performEMIteration() { final ExpectationStep expectationStep = new ExpectationStep(); relearnHiddenStateValues(expectationStep); relearnWeights(expectationStep); relearnMemoryLength(expectationStep); attemptBigChangeInMemoryLength(); relearnAdditionalParameters(expectationStep); pruneUnusedComponents(); relearnConcentration(); }

Target:
private void performEMIteration() { final ExpectationStep expectationStep = new ExpectationStep(); relearnHiddenStateValues(expectationStep); relearnWeights(expectationStep); reportStatesAndWeights("After M step"); relearnMemoryLength(expectationStep); attemptBigChangeInMemoryLength(); relearnAdditionalParameters(expectationStep); pruneUnusedComponents(); reportStatesAndWeights("After pruning"); relearnConcentration(); }
Source:
public void submitCategory() { waitForElementClickableByElement(saveCategory); saveCategory.click(); waitForElementNotVisibleByElement(addCategoryInput); }

Target:
public void submitCategory() { waitForElementClickableByElement(saveCategory); saveCategory.click(); waitForElementNotVisibleByElement(addCategoryInput); PageObjectLogging.log("submitCategory", "submit category clicked", true); }
Source:
public int read(byte[] b, int off, int len) throws IOException { int cnt = 0; while (0 < len) { final InputStream in = head(); final int n = in.read(b, off, len); if (0 < n) { cnt += n; off += n; len -= n; break; } else if (in == EOF) return 0 < cnt ? cnt : -1; else pop(); } return cnt; }

Target:
public int read(byte[] b, int off, int len) throws IOException { if (len == 0) return 0; for (;;) { final InputStream in = head(); final int n = in.read(b, off, len); if (0 < n) return n; else if (in == EOF) return -1; else pop(); } }
Source:
public void run() { while (isOpen.get()) { boolean allChunksFillComplete = true; Iterator<PutOperation> iter = putOperations.values().iterator(); while (iter.hasNext()) { PutOperation op = iter.next(); if (!op.fillChunks()) { allChunksFillComplete = false; } } if (allChunksFillComplete) { try { Thread.sleep(sleepTimeWhenIdleMs); } catch (InterruptedException e) { logger.info("Caught interrupted exception while sleeping", e); Thread.currentThread().interrupt(); } } } }

Target:
public void run() { try { while (isOpen.get()) { boolean allChunksFilled = true; Iterator<PutOperation> iter = putOperations.iterator(); while (iter.hasNext()) { PutOperation op = iter.next(); if (!op.isChunkFillComplete()) { op.fillChunks(); allChunksFilled = false; } } if (allChunksFilled) { Thread.sleep(sleepTimeWhenIdleMs); } } } catch (Exception e) { logger.error("Aborting, as ChunkFillerThread received an exception: ", e); } finally { isOpen.set(false); } }
Source:
Issue create( @NotNull(message = "issue title is never NULL") String title, @NotNull(message = "issue body is never NULL") String body) throws IOException; @NotNull(message = "iterable is never NULL") Iterable<Issue> iterate(@NotNull(message = "map of params can't be NULL") Map<String, String> params); @NotNull(message = "Iterable of issues is never NULL") Iterable<Issue> search( @NotNull(message = "Sort field can't be NULL") Sort sort, @NotNull(message = "Sort direction can't be NULL") Search.Order direction, @NotNull(message = "Search qualifiers can't be NULL") EnumMap<Qualifier, String> qualifiers) throws IOException; enum Qualifier { MILESTONE("milestone"), STATE("state"), ASSIGNEE("assignee"), CREATOR("creator"), MENTIONED("mentioned"), LABELS("labels"), SINCE("since"); private final transient String qualifier; Qualifier(final String key) { this.qualifier = key; } public String getQualifier() { return this.qualifier; } }

Target:
Issue create( @NotNull(message = "issue title is never NULL") String title, @NotNull(message = "issue body is never NULL") String body) throws IOException; @NotNull(message = "iterable is never NULL") Iterable<Issue> iterate(@NotNull(message = "map of params can't be NULL") Map<String, String> params); @NotNull(message = "Iterable of issues is never NULL") Iterable<Issue> search( @NotNull(message = "Sort field can't be NULL") Sort sort, @NotNull(message = "Sort direction can't be NULL") Search.Order direction, @NotNull(message = "Search qualifiers can't be NULL") EnumMap<Qualifier, String> qualifiers) throws IOException; enum Qualifier implements StringEnum { MILESTONE("milestone"), STATE("state"), ASSIGNEE("assignee"), CREATOR("creator"), MENTIONED("mentioned"), LABELS("labels"), SINCE("since"); private final transient String qualifier; Qualifier(final String key) { this.qualifier = key; } @Override @NotNull(message = "identifier string is never NULL") public String identifier() { return this.qualifier; } }
Source:
public RelDataType implicitCast(RelDataType in, SqlTypeFamily expected) { List<SqlTypeFamily> numericFamilies = Lists.newArrayList( SqlTypeFamily.NUMERIC, SqlTypeFamily.DECIMAL, SqlTypeFamily.APPROXIMATE_NUMERIC, SqlTypeFamily.EXACT_NUMERIC, SqlTypeFamily.INTEGER); List<SqlTypeFamily> dateTimeFamilies = Lists.newArrayList(SqlTypeFamily.DATE, SqlTypeFamily.TIME, SqlTypeFamily.TIMESTAMP); if (expected.getTypeNames().contains(in.getSqlTypeName())) { return in; } if (SqlTypeUtil.isNull(in)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isNumeric(in) && expected == SqlTypeFamily.DECIMAL) { return factory.decimalOf(in); } if (SqlTypeUtil.isApproximateNumeric(in) && expected == SqlTypeFamily.EXACT_NUMERIC) { return factory.decimalOf(in); } if (SqlTypeUtil.isDate(in) && expected == SqlTypeFamily.TIMESTAMP) { return factory.createSqlType(SqlTypeName.TIMESTAMP); } if (SqlTypeUtil.isTimestamp(in) && expected == SqlTypeFamily.DATE) { return factory.createSqlType(SqlTypeName.DATE); } if (SqlTypeUtil.isCharacter(in) && numericFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && dateTimeFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && expected == SqlTypeFamily.BINARY) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isAtomic(in) && (expected == SqlTypeFamily.STRING || expected == SqlTypeFamily.CHARACTER)) { return expected.getDefaultConcreteType(factory); } return null; }

Target:
public RelDataType implicitCast(RelDataType in, SqlTypeFamily expected) { List<SqlTypeFamily> numericFamilies = ImmutableList.of( SqlTypeFamily.NUMERIC, SqlTypeFamily.DECIMAL, SqlTypeFamily.APPROXIMATE_NUMERIC, SqlTypeFamily.EXACT_NUMERIC, SqlTypeFamily.INTEGER); List<SqlTypeFamily> dateTimeFamilies = ImmutableList.of(SqlTypeFamily.DATE, SqlTypeFamily.TIME, SqlTypeFamily.TIMESTAMP); if (expected.getTypeNames().contains(in.getSqlTypeName())) { return in; } if (SqlTypeUtil.isNull(in)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isNumeric(in) && expected == SqlTypeFamily.DECIMAL) { return factory.decimalOf(in); } if (SqlTypeUtil.isApproximateNumeric(in) && expected == SqlTypeFamily.EXACT_NUMERIC) { return factory.decimalOf(in); } if (SqlTypeUtil.isDate(in) && expected == SqlTypeFamily.TIMESTAMP) { return factory.createSqlType(SqlTypeName.TIMESTAMP); } if (SqlTypeUtil.isTimestamp(in) && expected == SqlTypeFamily.DATE) { return factory.createSqlType(SqlTypeName.DATE); } if (SqlTypeUtil.isCharacter(in) && numericFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && dateTimeFamilies.contains(expected)) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isCharacter(in) && expected == SqlTypeFamily.BINARY) { return expected.getDefaultConcreteType(factory); } if (SqlTypeUtil.isAtomic(in) && (expected == SqlTypeFamily.STRING || expected == SqlTypeFamily.CHARACTER)) { return expected.getDefaultConcreteType(factory); } return null; }
Source:
public static Collection Collection(Context context, String path, boolean server, boolean log) { assert path.endsWith(".anki2"); Hooks.getInstance(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context.getApplicationContext()); if (prefs.getBoolean("convertFenText", false)) { ChessFilter.enable(); } File dbFile = new File(path); boolean create = !dbFile.exists(); DB db = new DB(path); try { int ver; if (create) { ver = _createDB(db); } else { ver = _upgradeSchema(db); } db.execute("PRAGMA temp_store = memory"); Collection col = new Collection(context, db, path, server, log); if (ver < Consts.SCHEMA_VERSION) { _upgrade(col, ver); } else if (ver > Consts.SCHEMA_VERSION) { throw new RuntimeException("This file requires a newer version of Anki."); } else if (create) { for (int i = StdModels.stdModels.length-1; i>=0; i--) { StdModels.stdModels[i].add(col); } col.save(); } return col; } catch (Exception e) { Timber.e(e, "Error opening collection; closing database"); db.close(); throw e; } }

Target:
public static Collection Collection(Context context, String path, boolean server, boolean log) { assert path.endsWith(".anki2"); Hooks.getInstance(context); File dbFile = new File(path); boolean create = !dbFile.exists(); DB db = new DB(path); try { int ver; if (create) { ver = _createDB(db); } else { ver = _upgradeSchema(db); } db.execute("PRAGMA temp_store = memory"); Collection col = new Collection(context, db, path, server, log); if (ver < Consts.SCHEMA_VERSION) { _upgrade(col, ver); } else if (ver > Consts.SCHEMA_VERSION) { throw new RuntimeException("This file requires a newer version of Anki."); } else if (create) { for (int i = StdModels.stdModels.length-1; i>=0; i--) { StdModels.stdModels[i].add(col); } col.save(); } return col; } catch (Exception e) { Timber.e(e, "Error opening collection; closing database"); db.close(); throw e; } }
Source:
public PlanetConfigs(HullConfigManager hullConfigs, GameColors cols, ItemManager itemManager) { allConfigs = new HashMap<>(); easy = new ArrayList<>(); medium = new ArrayList<>(); hard = new ArrayList<>(); Set<ResourceUrn> planetJsonConfigs = Assets.getAssetHelper().list(Json.class, "[a-zA-Z0-9]*:planetsConfig"); for (ResourceUrn planetConfigJson : planetJsonConfigs) { Assets.cacheLists(); Json json = Assets.getJson(planetConfigJson.toString()); JsonValue rootNode = json.getJsonValue(); for (JsonValue node : rootNode) { PlanetConfig planetConfig = PlanetConfig.load(node, hullConfigs, cols, itemManager); allConfigs.put(node.name, planetConfig); if (planetConfig.hardOnly) { hard.add(planetConfig); } else if (planetConfig.easyOnly) { easy.add(planetConfig); } else { medium.add(planetConfig); } } json.dispose(); Assets.uncacheLists(); } }

Target:
public PlanetConfigs(HullConfigManager hullConfigs, GameColors cols, ItemManager itemManager) { allConfigs = new HashMap<>(); easy = new ArrayList<>(); medium = new ArrayList<>(); hard = new ArrayList<>(); Set<ResourceUrn> planetJsonConfigs = Assets.getAssetHelper().list(Json.class, "[a-zA-Z0-9]*:planetsConfig"); for (ResourceUrn planetConfigJson : planetJsonConfigs) { String moduleName = planetConfigJson.getModuleName().toString(); Json json = Assets.getJson(planetConfigJson.toString()); JsonValue rootNode = json.getJsonValue(); for (JsonValue node : rootNode) { PlanetConfig planetConfig = PlanetConfig.load(node, hullConfigs, cols, itemManager, moduleName); allConfigs.put(node.name, planetConfig); if (planetConfig.hardOnly) { hard.add(planetConfig); } else if (planetConfig.easyOnly) { easy.add(planetConfig); } else { medium.add(planetConfig); } } json.dispose(); } }
Source:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { boolean stopGlusterService = false; if (getVds().getClusterSupportsGlusterService()) { boolean returnValue = resourceManager.runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(getVdsId())).getSucceeded(); if (returnValue) { stopGlusterService = true; } } Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(stopGlusterService), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }

Target:
protected void executeCommand() { VDSStatus statusBeforeUpgrade = getVds().getStatus(); if (statusBeforeUpgrade != VDSStatus.Maintenance) { Future<ActionReturnValue> maintenanceCmd = commandCoordinatorUtil.executeAsyncCommand(ActionType.MaintenanceNumberOfVdss, createMaintenanceParams(), cloneContext()); ActionReturnValue result; try { result = maintenanceCmd.get(); if (!result.getSucceeded()) { propagateFailure(result); return; } } catch (InterruptedException | ExecutionException e) { log.error("Exception", e); return; } } setSucceeded(true); }
Source:
public ExtendedFileSystem createCachingFileSystem( Configuration factoryConfig, URI factoryUri, ExtendedFileSystem fileSystem, CacheManager cacheManager, boolean cachingEnabled, CacheType cacheType, boolean validationEnabled) throws IOException { if (!cachingEnabled) { return fileSystem; } checkState(cacheType != null); if (cacheType == ALLUXIO) { ExtendedFileSystem cachingFileSystem = new AlluxioCachingFileSystem(fileSystem, factoryUri); cachingFileSystem.initialize(factoryUri, factoryConfig); return cachingFileSystem; } return new FileMergeCachingFileSystem( factoryUri, factoryConfig, cacheManager, fileSystem, validationEnabled); }

Target:
public ExtendedFileSystem createCachingFileSystem( Configuration factoryConfig, URI factoryUri, ExtendedFileSystem fileSystem, CacheManager cacheManager, boolean cachingEnabled, CacheType cacheType, boolean validationEnabled) throws IOException { if (!cachingEnabled) { return fileSystem; } checkState(cacheType != null); switch (cacheType) { case FILE_MERGE: return new FileMergeCachingFileSystem( factoryUri, factoryConfig, cacheManager, fileSystem, validationEnabled); case ALLUXIO: ExtendedFileSystem cachingFileSystem = new AlluxioCachingFileSystem(fileSystem, factoryUri); cachingFileSystem.initialize(factoryUri, factoryConfig); return cachingFileSystem; default: throw new IllegalArgumentException("Invalid CacheType: " + cacheType.name()); } }
Source:
public int upgradeTablePriorities(TransactionController tc) throws Exception { PartitionAdmin admin = SIDriver.driver().getTableFactory().getAdmin(); ArrayList<String> toUpgrade = new ArrayList<>(); Function<TabInfoImpl, Void> addTabInfo = (TabInfoImpl info ) -> { toUpgrade.add( Long.toString(info.getHeapConglomerate()) ); for( int j = 0; j < info.getNumberOfIndexes(); j++ ) toUpgrade.add( Long.toString(info.getIndexConglomerate(j)) ); return null; }; for (int i = 0; i < coreInfo.length; ++i) { assert coreInfo[i] != null; addTabInfo.apply(coreInfo[i]); } for (int i = 0; i < NUM_NONCORE; ++i) { TabInfoImpl ti = getNonCoreTIByNumber(i+NUM_CORE); faultInTabInfo(ti); addTabInfo.apply(ti); } for( String s : HBaseConfiguration.internalTablesArr) { toUpgrade.add(s); } toUpgrade.add("16"); toUpgrade.add(SIConfigurations.CONGLOMERATE_TABLE_NAME); return admin.upgradeTablePrioritiesFromList(toUpgrade); }

Target:
public int upgradeTablePriorities(TransactionController tc) throws Exception { PartitionAdmin admin = SIDriver.driver().getTableFactory().getAdmin(); ArrayList<String> toUpgrade = new ArrayList<>(); Function<TabInfoImpl, Void> addTabInfo = (TabInfoImpl info ) -> { toUpgrade.add( Long.toString(info.getHeapConglomerate()) ); for( int j = 0; j < info.getNumberOfIndexes(); j++ ) toUpgrade.add( Long.toString(info.getIndexConglomerate(j)) ); return null; }; for (int i = 0; i < coreInfo.length; ++i) { assert coreInfo[i] != null; addTabInfo.apply(coreInfo[i]); } for (int i = 0; i < NUM_NONCORE; ++i) { addTabInfo.apply( getNonCoreTI(i+NUM_CORE) ); } for( String s : HBaseConfiguration.internalTablesArr) { toUpgrade.add(s); } toUpgrade.add("16"); toUpgrade.add(SIConfigurations.CONGLOMERATE_TABLE_NAME); return admin.upgradeTablePrioritiesFromList(toUpgrade); }
Source:
private void waitForActive() throws DependencyException { ConsumerStatus status = null; int retries = maxDescribeStreamConsumerRetries; while (!ConsumerStatus.ACTIVE.equals(status) && retries > 0) { status = describeStreamConsumer().consumerDescription().consumerStatus(); retries--; try { log.info(String.format("Waiting for StreamConsumer %s to have ACTIVE status...", streamConsumerName)); Thread.sleep(retryBackoffMillis); } catch (InterruptedException ie) { log.debug("Sleep interrupted, will immediately retry fetching StreamConsumer status."); } } if (!ConsumerStatus.ACTIVE.equals(status)) { final String message = String.format( "Status of StreamConsumer %s, was not ACTIVE after all retries. Was instead %s.", streamConsumerName, status); log.error(message); throw new IllegalStateException(message); } }

Target:
private void waitForActive() throws DependencyException { ConsumerStatus status = null; int retries = maxDescribeStreamConsumerRetries; try { while (!ConsumerStatus.ACTIVE.equals(status) && retries > 0) { status = describeStreamConsumer().consumerDescription().consumerStatus(); retries--; log.info(String.format("Waiting for StreamConsumer %s to have ACTIVE status...", streamConsumerName)); Thread.sleep(retryBackoffMillis); } } catch (InterruptedException ie) { log.debug("Thread was interrupted while fetching StreamConsumer status, moving on."); } if (!ConsumerStatus.ACTIVE.equals(status)) { final String message = String.format( "Status of StreamConsumer %s, was not ACTIVE after all retries. Was instead %s.", streamConsumerName, status); log.error(message); throw new IllegalStateException(message); } }
Source:
public static void registerTags() { registerTag("name", (attribute, object) -> { return new ElementTag(object.getSpawner().getName()); }); registerTag("cooldown", (attribute, object) -> { return new DurationTag(object.getSpawner().getCooldownSeconds()); }); registerTag("mythic_mobs", (attribute, object) -> { ArrayList<MythicMobsMobTag> list = new ArrayList<>(); for (UUID uuid : object.getSpawner().getAssociatedMobs()){ list.add(MythicMobsMobTag.valueOf(uuid.toString())); } return new ListTag(list); }); registerTag("mob_type", (attribute, object) -> { return new ElementTag(object.getSpawner().getTypeName()); }); registerTag("mobs", (attribute, object) -> { ArrayList<EntityTag> list = new ArrayList<>(); for (UUID uuid : object.getSpawner().getAssociatedMobs()){ list.add(new EntityTag(MythicMobsMobTag.valueOf(uuid.toString()).getEntity())); } return new ListTag(list); }); registerTag("location", (attribute, object) -> { AbstractLocation loc = object.getSpawner().getLocation(); return new LocationTag((World) loc.getWorld(), loc.getX(), loc.getY(), loc.getZ()); }); registerTag("group", (attribute, object) -> { return new ElementTag(object.getSpawner().getGroup()); }); }

Target:
public static void registerTags() { registerTag("name", (attribute, object) -> { return new ElementTag(object.getSpawner().getName()); }); registerTag("cooldown", (attribute, object) -> { return new DurationTag(object.getSpawner().getCooldownSeconds()); }); registerTag("mythic_mobs", (attribute, object) -> { ListTag list = new ListTag(); for (UUID uuid : object.getSpawner().getAssociatedMobs()) { list.addObject(MythicMobsMobTag.valueOf(uuid.toString())); } return list; }); registerTag("mob_type", (attribute, object) -> { return new ElementTag(object.getSpawner().getTypeName()); }); registerTag("mobs", (attribute, object) -> { ArrayList<EntityTag> list = new ArrayList<>(); for (UUID uuid : object.getSpawner().getAssociatedMobs()) { list.add(new EntityTag(MythicMobsMobTag.valueOf(uuid.toString()).getEntity())); } return new ListTag(list); }); registerTag("location", (attribute, object) -> { AbstractLocation loc = object.getSpawner().getLocation(); return new LocationTag((World) loc.getWorld(), loc.getX(), loc.getY(), loc.getZ()); }); registerTag("group", (attribute, object) -> { return new ElementTag(object.getSpawner().getGroup()); }); }
Source:
public void adsTrackingRejectedForMoat(String[] instantGlobals, List<String> urlPatterns) { networkTrafficInterceptor.startIntercepting(); TrackingOptInModal modal = new TrackingOptInModal(); modal.rejectOptInModal(driver, POLAND, ADS_HOME_PAGE, instantGlobals); modal.verifyTrackingRequestsNotSend(urlPatterns, networkTrafficInterceptor); }

Target:
public void adsTrackingRejectedForMoat(String[] instantGlobals, List<String> urlPatterns) { networkTrafficInterceptor.startIntercepting(); TrackingOptInModal modal = new TrackingOptInModal(); modal.rejectOptInModal(driver, POLAND, ADS_HIVI_PAGE, instantGlobals); modal.verifyTrackingRequestsSend(urlPatterns, networkTrafficInterceptor); }
Source:
private void checkPage() { boolean errorFound = false; setErrorMessage(null); String t = nameText.getText(); if (t.length() > 0 && !Repository.isValidRefName(Constants.R_REMOTES + t)) { setErrorMessage(NLS.bind(UIText.NewRemoteDialog_InvalidRemoteName, t)); errorFound = true; } if (existingRemotes.contains(t)) { setErrorMessage(NLS.bind( UIText.NewRemoteDialog_RemoteAlreadyExistsMessage, t)); errorFound = true; } getButton(OK).setEnabled(!errorFound); }

Target:
private void checkPage() { boolean errorFound = false; setErrorMessage(null); String t = getTrimmedRemoteName(); if (t.length() > 0 && !Repository.isValidRefName(Constants.R_REMOTES + t)) { setErrorMessage(NLS.bind(UIText.NewRemoteDialog_InvalidRemoteName, t)); errorFound = true; } else if (existingRemotes.contains(t)) { setErrorMessage(NLS.bind( UIText.NewRemoteDialog_RemoteAlreadyExistsMessage, t)); errorFound = true; } getButton(OK).setEnabled(!errorFound); }
Source:
public static void addNewMinishiftServer(String serverAdapter, String hypervisor, String path, String profile) { NewCDKServerWizard dialog = setupFirstNewServerWizardPage(MINISHIFT_SERVER_NAME, serverAdapter); NewMinishiftServerWizardPage containerPage = new NewMinishiftServerWizardPage(); if (hypervisor != null && !hypervisor.isEmpty()) { log.info("Setting hypervisor to " + hypervisor); containerPage.setHypervisor(hypervisor); } log.info("Setting minishift binary file folder to " + path); containerPage.setMinishiftBinary(path); log.info("Setting minishift profile to " + profile); containerPage.setMinishiftProfile(profile); new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.DEFAULT); log.info("Finishing Add new server dialog"); if (!(new FinishButton().isEnabled())) { log.error("Finish button was not enabled"); } dialog.finish(TimePeriod.MEDIUM); }

Target:
public static void addNewMinishiftServer(String serverAdapter, String hypervisor, String path, String profile) { NewCDKServerWizard dialog = setupFirstNewServerWizardPage(MINISHIFT_SERVER_NAME, serverAdapter); NewMinishiftServerWizardPage containerPage = new NewMinishiftServerWizardPage(); if (!StringUtils.isEmptyOrNull(hypervisor)) { log.info("Setting hypervisor to " + hypervisor); containerPage.setHypervisor(hypervisor); } log.info("Setting minishift binary file folder to " + path); containerPage.setMinishiftBinary(path); log.info("Setting minishift profile to " + profile); containerPage.setMinishiftProfile(profile); new WaitUntil(new ControlIsEnabled(new FinishButton()), TimePeriod.DEFAULT); log.info("Finishing Add new server dialog"); if (!(new FinishButton().isEnabled())) { log.error("Finish button was not enabled"); } dialog.finish(TimePeriod.MEDIUM); }
Source:
public static void setSnapshots(MobSpawnerBaseLogic logic, WeightedTable<EntitySnapshot> table) { logic.minecartToSpawn.clear(); for (TableEntry<EntitySnapshot> entry : table) { if(!(entry instanceof WeightedObject)) continue; WeightedObject<EntitySnapshot> object = (WeightedObject<EntitySnapshot>) entry; if(!(object.get() instanceof SpongeEntitySnapshot)) continue; String name = EntityList.classToStringMapping.get(object.get().getType().getEntityClass()); NBTTagCompound compound = ((SpongeEntitySnapshot) object.get()).getCompound().get(); logic.minecartToSpawn.add(logic.new WeightedRandomMinecart(compound, name)); } }

Target:
public static void setSnapshots(MobSpawnerBaseLogic logic, WeightedTable<EntitySnapshot> table) { logic.minecartToSpawn.clear(); for (TableEntry<EntitySnapshot> entry : table) { if(!(entry instanceof WeightedObject)) continue; WeightedObject<EntitySnapshot> object = (WeightedObject<EntitySnapshot>) entry; NBTTagCompound compound; if(object.get() instanceof SpongeEntitySnapshot) { SpongeEntitySnapshot snapshot = (SpongeEntitySnapshot) object.get(); compound = snapshot.getCompound().orElse(new NBTTagCompound()); } else { compound = new NBTTagCompound(); } String name = EntityList.classToStringMapping.get(object.get().getType().getEntityClass()); logic.minecartToSpawn.add(logic.new WeightedRandomMinecart(compound, name)); } }
Source:
public GenericRow transform(GenericRow record) throws DataTypeConversionException { for (Map.Entry<String, PinotDataType> entry : _dataTypes.entrySet()) { String column = entry.getKey(); Object value = record.getValue(column); if (value == null) { continue; } PinotDataType dest = entry.getValue(); value = standardize(column, value, dest.isSingleValue()); if (value == null) { record.putValue(column, null); continue; } PinotDataType source; if (value instanceof Object[]) { Object[] values = (Object[]) value; source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass()); if (source == null) { source = PinotDataType.OBJECT_ARRAY; } } else { source = SINGLE_VALUE_TYPE_MAP.get(value.getClass()); if (source == null) { source = PinotDataType.OBJECT; } } if (source != dest) { try { value = dest.convert(value, source); } catch (Exception e) { throw new DataTypeConversionException(column, source, dest, e); } } record.putValue(column, value); } return record; }

Target:
public GenericRow transform(GenericRow record) { for (Map.Entry<String, PinotDataType> entry : _dataTypes.entrySet()) { String column = entry.getKey(); Object value = record.getValue(column); if (value == null) { continue; } PinotDataType dest = entry.getValue(); value = standardize(column, value, dest.isSingleValue()); if (value == null) { record.putValue(column, null); continue; } PinotDataType source; if (value instanceof Object[]) { Object[] values = (Object[]) value; source = MULTI_VALUE_TYPE_MAP.get(values[0].getClass()); if (source == null) { source = PinotDataType.OBJECT_ARRAY; } } else { source = SINGLE_VALUE_TYPE_MAP.get(value.getClass()); if (source == null) { source = PinotDataType.OBJECT; } } if (source != dest) { value = dest.convert(value, source); } record.putValue(column, value); } return record; }
Source:
public void onItemLoad(AttachCapabilitiesEvent.Item event) { if (!event.getItemStack().func_190926_b() && event.getItemStack().getItem() == Items.STICK) event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider(event.getItemStack())); }

Target:
public void onItemLoad(AttachCapabilitiesEvent.Item event) { if (event.getItemStack().getItem() == Items.STICK) event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider(event.getItemStack())); }
Source:
public void render(Canvas canvas) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { colors[x + y * width] = palette[field[x][y]]; } } canvas.scale(scale_x, scale_y); canvas.drawBitmap(colors, 0, width, 0, 0, width, height, false, paint); }

Target:
public void render(Canvas canvas) { for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { colors[x + y * width] = palette[field[x][y]]; } } canvas.save(); canvas.scale(scale_x, scale_y); canvas.drawBitmap(colors, 0, width, 0, 0, width, height, false, paint); canvas.restore(); }
Source:
public void testReaderWithoutPreparedStatement() throws SQLException, IOException { Statement statement = Mockito.mock(Statement.class); Mockito.when(connection.createStatement()).thenReturn(statement); rs = Mockito.mock(ResultSet.class); ResultSetMetaData rsMetadata = Mockito.mock(ResultSetMetaData.class); Mockito.when(rs.getMetaData()).thenReturn(rsMetadata); Mockito.when(rsMetadata.getColumnCount()).thenReturn(1); Mockito.when(rs.getString(1)).thenReturn(FIELD_VALUE); Mockito.when(statement.executeQuery(Mockito.eq(query))).thenReturn(rs); Mockito.when(rs.next()).thenReturn(true, false); try { do { if (reader.start()) { IndexedRecord indexedRecord = reader.getCurrent(); Assert.assertEquals(FIELD_VALUE, indexedRecord.get(indexedRecord.getSchema().getField("name").pos())); } } while (reader.advance()); } catch (IOException ioe) { Assert.fail("Should not get here"); } finally { reader.close(); } Map<String, Object> resultMap = reader.getReturnValues(); Assert.assertEquals(1, resultMap.get(ComponentDefinition.RETURN_TOTAL_RECORD_COUNT)); }

Target:
public void testReaderWithoutPreparedStatement() throws SQLException, IOException { Statement statement = Mockito.mock(Statement.class); Mockito.when(connection.createStatement()).thenReturn(statement); rs = Mockito.mock(ResultSet.class); ResultSetMetaData rsMetadata = Mockito.mock(ResultSetMetaData.class); Mockito.when(rs.getMetaData()).thenReturn(rsMetadata); Mockito.when(rsMetadata.getColumnCount()).thenReturn(1); Mockito.when(rs.getString(1)).thenReturn(FIELD_VALUE); Mockito.when(statement.executeQuery(Mockito.eq(query))).thenReturn(rs); Mockito.when(rs.next()).thenReturn(true, false); try { if (reader.start()) { do { IndexedRecord indexedRecord = reader.getCurrent(); Assert.assertEquals(FIELD_VALUE, indexedRecord.get(indexedRecord.getSchema().getField("name").pos())); } while (reader.advance()); } else { Assert.fail("Shouldn't get here"); } } finally { reader.close(); } Map<String, Object> resultMap = reader.getReturnValues(); Assert.assertEquals(1, resultMap.get(ComponentDefinition.RETURN_TOTAL_RECORD_COUNT)); }
Source:
public void setDeepenNots(List<ObjectId> deepenNots) { this.deepenNots = deepenNots; }

Target:
public void setDeepenNots(List<ObjectId> deepenNots) { this.deepenNots = Objects.requireNonNull(deepenNots); }
Source:
private String getDescription(final String propertyFile, final String propertyName) { String description = null; try { if (propertyFile == null || propertyFile.trim().isEmpty()) { LOG.error("propertyFile value is null"); } else if (propertyName == null || propertyName.trim().isEmpty()) { LOG.error("propertyName value is null"); } else { description = PropertyAccessor.getInstance().getProperty(propertyFile, propertyName); } } catch (final Exception e) { LOG.error("Exception while reading the property: " + propertyFile + "." + propertyName, e); } return description; }

Target:
private String getDescription(final String propertyFile, final String propertyName) { String description = null; try { if (StringUtils.isBlank(propertyFile)) { LOG.error("propertyFile value is null"); } else if (StringUtils.isBlank(propertyName)) { LOG.error("propertyName value is null"); } else { description = PropertyAccessor.getInstance().getProperty(propertyFile, propertyName); } } catch (final Exception e) { LOG.error("Exception while reading the property: {}.{} : {}", propertyFile, propertyName, e.getLocalizedMessage(), e); } return description; }
Source:
public static File dumpQueueData(String data) throws IOException { if (!isExternalStorageWritable()) { throw new IllegalStateException("External storage is not writable!"); } String path = getExternalStoragePath() + "/" + "Local_changes_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".txt"; File file = new File(path); file.createNewFile(); try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { writer.write(data); } return file; }

Target:
public static File dumpQueueData(String data) throws IOException { if (!isExternalStorageWritable()) { throw new IllegalStateException("External storage is not writable!"); } String path = getExternalStoragePath() + "/" + "Local_changes_" + new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(new Date()) + ".txt"; File file = new File(path); file.createNewFile(); try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) { writer.write(data); } return file; }
Source:
private void processKey(final int keyCode, boolean shiftKeyPressed, final String value) { this.value = value; if ((13 == keyCode) && (!shiftKeyPressed)) { onSave(); } }

Target:
private void processKey(final int keyCode, boolean shiftKeyPressed, final String value) { this.value = value; if ((KeyCodes.KEY_ENTER == keyCode) && (!shiftKeyPressed)) { onSave(); } }