auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object createGeometry(Instance instance, int srsDimension, IOProvider reader) throws GeometryNotSupportedException { @SuppressWarnings("unchecked") DefaultGeometryProperty<LineString> lineStringGeomProperty = (DefaultGeometryProperty<LineString>) super.createGeometry( instance, srsDimension, reader); double maxPositionalError = reader .getParameter(InterpolationConstant.INTERPOL_MAX_POSITION_ERROR).as(Double.class); Interpolation<LineString> interpolation = new ArcInterpolation( lineStringGeomProperty.getGeometry().getCoordinates(), maxPositionalError); LineString interpolatedArc = interpolation.interpolateRawGeometry(); if (interpolatedArc != null) return new DefaultGeometryProperty<LineString>( lineStringGeomProperty.getCRSDefinition(), interpolatedArc); return null; }

Target:
public Object createGeometry(Instance instance, int srsDimension, IOProvider reader) throws GeometryNotSupportedException { @SuppressWarnings("unchecked") DefaultGeometryProperty<LineString> lineStringGeomProperty = (DefaultGeometryProperty<LineString>) super.createGeometry( instance, srsDimension, reader); Double maxPositionalError = reader .getParameter(InterpolationConstant.INTERPOL_MAX_POSITION_ERROR).as(Double.class); if (maxPositionalError == null || maxPositionalError.doubleValue() <= 0) { log.warn( "Value of Max positional error parameter, for interpolation operation, is not valid. Default value has been taken."); maxPositionalError = InterpolationConstant.DEFAULT_INTERPOL_MAX_POSITION_ERROR; } Interpolation<LineString> interpolation = new ArcInterpolation( lineStringGeomProperty.getGeometry().getCoordinates(), maxPositionalError.doubleValue()); LineString interpolatedArc = interpolation.interpolateRawGeometry(); if (interpolatedArc != null) return new DefaultGeometryProperty<LineString>( lineStringGeomProperty.getCRSDefinition(), interpolatedArc); return null; }
Source:
protected void onResume() { super.onResume(); if (mOsmv == null) { mOsmv = new MapView(this); this.mOsmv.setTilesScaledToDpi(true); this.mOsmv.setBuiltInZoomControls(true); this.mOsmv.getController().setZoom(18); mProvider = new MapTileProviderBasic(getApplicationContext()); mProvider.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE); this.mTilesOverlay = new TilesOverlay(mProvider, this.getBaseContext()); this.mOsmv.getOverlays().add(this.mTilesOverlay); rl = new RelativeLayout(this); rl.addView(this.mOsmv, new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); this.setContentView(rl); } mIALocationManager.requestLocationUpdates(IALocationRequest.create(), mListener); mIALocationManager.registerRegionListener(mRegionListener); }

Target:
protected void onResume() { super.onResume(); if (mOsmv == null) { mOsmv = new MapView(this); mOsmv.setTilesScaledToDpi(true); mOsmv.setBuiltInZoomControls(true); mOsmv.getController().setZoom(18); mProvider = new MapTileProviderBasic(getApplicationContext()); mProvider.setTileSource(TileSourceFactory.DEFAULT_TILE_SOURCE); mTilesOverlay = new TilesOverlay(mProvider, getBaseContext()); mOsmv.getOverlays().add(mTilesOverlay); mLayout = new RelativeLayout(this); mLayout.addView(mOsmv, new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); setContentView(mLayout); } mIALocationManager.requestLocationUpdates(IALocationRequest.create(), mListener); mIALocationManager.registerRegionListener(mRegionListener); }
Source:
public DerivativeDataSourceMetadata( @JsonProperty("baseDataSource") String baseDataSource, @JsonProperty("dimensions") Set<String> dimensions, @JsonProperty("metrics") Set<String> metrics ) { this.dimensions = Preconditions.checkNotNull(dimensions, "dimensions cannot be null. This is not a valid DerivativeDataSourceMetadata."); this.metrics = Preconditions.checkNotNull(metrics, "metrics cannot be null. This is not a valid DerivativeDataSourceMetadata."); Preconditions.checkArgument(!Strings.isNullOrEmpty(baseDataSource), "baseDataSource cannot be null or empty. Please provide a baseDataSource."); this.baseDataSource = baseDataSource; }

Target:
public DerivativeDataSourceMetadata( @JsonProperty("baseDataSource") String baseDataSource, @JsonProperty("dimensions") Set<String> dimensions, @JsonProperty("metrics") Set<String> metrics ) { Preconditions.checkArgument(!Strings.isNullOrEmpty(baseDataSource), "baseDataSource cannot be null or empty. Please provide a baseDataSource."); this.baseDataSource = baseDataSource; this.dimensions = Preconditions.checkNotNull(dimensions, "dimensions cannot be null. This is not a valid DerivativeDataSourceMetadata."); this.metrics = Preconditions.checkNotNull(metrics, "metrics cannot be null. This is not a valid DerivativeDataSourceMetadata."); }
Source:
private RGB getRGBFromTheme(String value) { if (Platform.getBundle("org.eclipse.e4.ui.css.swt.theme") != null) { String backgroundColor = E4ThemeColor.getCssValueFromTheme(display, value); if (backgroundColor != null) { RGB themeColor = E4ThemeColor.getRGBFromCssString(backgroundColor); if (themeColor != null) { return themeColor; } } } return getImpliedBackground().getRGB(); }

Target:
private RGB getRGBFromTheme(String value) { if (Platform.getBundle("org.eclipse.e4.ui.css.swt.theme") != null) { String backgroundColor = E4ThemeColor.getCssValueFromTheme(display, value); if (backgroundColor != null) { RGB themeColor = E4ThemeColor.getRGBFromCssString(backgroundColor); if (themeColor != null) { return themeColor; } } } return null; }
Source:
public IEventDeclaration getEventDeclaration(int eventIndex) { if (eventIndex == EventDeclaration.UNSET_EVENT_ID) { return fEventUnsetId; } return fEvents.get(eventIndex); }

Target:
public IEventDeclaration getEventDeclaration(int eventIndex) { if (eventIndex == EventDeclaration.UNSET_EVENT_ID) { return fEvents.get(0); } return fEvents.get(eventIndex); }
Source:
public void testMultiAdditionMethods() { Bean<Axe> bean = getUniqueBean(Axe.class, new TwoHanded.TwoHandedLiteral(), new Reforged.ReforgedLiteral()); Set<Annotation> qualifiers = bean.getQualifiers(); Set<Class<? extends Annotation>> stereotypes = bean.getStereotypes(); Set<Type> types = bean.getTypes(); assertTrue(bean.getScope().equals(RequestScoped.class)); assertTrue(qualifiers.contains(new Reforged.ReforgedLiteral()) && qualifiers.contains(new TwoHanded.TwoHandedLiteral())); assertTrue(stereotypes.contains(Melee.class) && stereotypes.contains(Equipment.class)); assertTrue(types.contains(Weapon.class) && types.contains(Tool.class)); assertTrue(bean.isAlternative()); }

Target:
public void testMultiAdditionMethods() { Bean<Axe> bean = getUniqueBean(Axe.class, TwoHanded.TwoHandedLiteral.INSTANCE, Reforged.ReforgedLiteral.INSTANCE); Set<Annotation> qualifiers = bean.getQualifiers(); Set<Class<? extends Annotation>> stereotypes = bean.getStereotypes(); Set<Type> types = bean.getTypes(); assertTrue(bean.getScope().equals(RequestScoped.class)); assertTrue(qualifiers.containsAll(new HashSet<>(Arrays.asList(Reforged.ReforgedLiteral.INSTANCE, TwoHanded.TwoHandedLiteral.INSTANCE)))); assertTrue(stereotypes.containsAll(new HashSet<>(Arrays.asList(Melee.class, Equipment.class)))); assertTrue(types.containsAll(new HashSet<>(Arrays.asList(Weapon.class, Tool.class)))); assertTrue(bean.isAlternative()); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TurboUser that = (TurboUser) o; return (loginName == that.loginName || (loginName != null && loginName.equals(that.loginName))) && (realName == that.realName || (realName != null && realName.equals(that.realName))) && (avatarURL == that.avatarURL || (avatarURL != null && avatarURL.equals(that.avatarURL))); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TurboUser that = (TurboUser) o; return loginName.equals(that.loginName) && realName.equals(that.realName) && avatarURL.equals(that.avatarURL); }
Source:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); if ( this.excludeColumns == null) { writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty()) { writeMapToJSON("old", this.oldData, true); } } else { for (String column : this.excludeColumns) { this.data.remove(column); this.oldData.remove(column); } if ( !this.data.isEmpty() ) writeMapToJSON("data", this.data, true); if ( !this.oldData.isEmpty() ) writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }

Target:
public String toJSON() throws IOException { JsonGenerator g = jsonGeneratorThreadLocal.get(); g.writeStartObject(); g.writeStringField("database", this.database); g.writeStringField("table", this.table); g.writeStringField("type", this.rowType); g.writeNumberField("ts", this.timestamp); if ( this.xid != null ) g.writeNumberField("xid", this.xid); if ( this.txCommit ) g.writeBooleanField("commit", true); if ( this.excludeColumns != null ) { Set<String> keys = new HashSet<String>(); keys.addAll(this.data.keySet()); keys.addAll(this.oldData.keySet()); for ( Pattern p : this.excludeColumns ) { for ( String key : keys ) { if ( p.matcher(key).matches() ) { this.data.remove(key); this.oldData.remove(key); } } } } writeMapToJSON("data", this.data, false); if ( !this.oldData.isEmpty() ) { writeMapToJSON("old", this.oldData, true); } g.writeEndObject(); g.flush(); return jsonFromStream(); }
Source:
public void createVmDataCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final String publicKey, final Commands cmds) { if (vm != null && router != null && nic != null) { final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); final String zoneName = _dcDao.findById(router.getDataCenterId()).getName(); final IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(nic.getNetworkId(), vm.getId()); Host host = _hostDao.findById(vm.getHostId()); final Account caller = CallContext.current().getCallingAccount(); String destHostname = (VirtualMachineManager.AllowExposeHypervisorHostname.value() && VirtualMachineManager.AllowExposeHypervisorHostnameAccountLevel.valueIn(caller.getId())) ? host.getName() : null; cmds.addCommand( "vmdata", generateVmDataCommand(router, nic.getIPv4Address(), vm.getUserData(), serviceOffering, zoneName, staticNatIp == null || staticNatIp.getState() != IpAddress.State.Allocated ? null : staticNatIp.getAddress().addr(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId(), destHostname)); } }

Target:
public void createVmDataCommand(final VirtualRouter router, final UserVm vm, final NicVO nic, final String publicKey, final Commands cmds) { if (vm != null && router != null && nic != null) { final String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()).getDisplayText(); final String zoneName = _dcDao.findById(router.getDataCenterId()).getName(); final IPAddressVO staticNatIp = _ipAddressDao.findByVmIdAndNetworkId(nic.getNetworkId(), vm.getId()); Host host = _hostDao.findById(vm.getHostId()); String destHostname = VirtualMachineManager.getHypervisorHostname(host.getName()); cmds.addCommand( "vmdata", generateVmDataCommand(router, nic.getIPv4Address(), vm.getUserData(), serviceOffering, zoneName, staticNatIp == null || staticNatIp.getState() != IpAddress.State.Allocated ? null : staticNatIp.getAddress().addr(), vm.getHostName(), vm.getInstanceName(), vm.getId(), vm.getUuid(), publicKey, nic.getNetworkId(), destHostname)); } }
Source:
public List<String> getURLsFromPage(Document doc) { List<String> imageURLs = new ArrayList<String>(); Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*"); for (Element thumb : doc.select("td > a:first-child")) { if (isStopped()) { break; } Matcher imgMatcher = imgRegex.matcher(thumb.attr("href")); if (!imgMatcher.matches()) { logger.info("Couldn't find user & image ID in " + thumb.attr("href")); continue; } String[] titleSplit = thumb.attr("herf").split("/"); String title = titleSplit[titleSplit.length -1]; String user = imgMatcher.group(1), imageId = imgMatcher.group(2); String image = "<LINK_1>"; image += user.toLowerCase().charAt(0); image += "/" + user + "/" + imageId + "/" + user + "-" + imageId + title + ".png"; imageURLs.add(image); } return imageURLs; }

Target:
public List<String> getURLsFromPage(Document doc) { List<String> imageURLs = new ArrayList<String>(); Pattern imgRegex = Pattern.compile(".*/user/([a-zA-Z0-9\\-_]+)/(\\d+)/.*"); for (Element thumb : doc.select("div.thumb_square > a.thumbLink")) { if (isStopped()) { break; } Matcher imgMatcher = imgRegex.matcher(thumb.attr("href")); if (!imgMatcher.matches()) { logger.info("Couldn't find user & image ID in " + thumb.attr("href")); continue; } Document imagePage; try { Response resp = Http.url("<LINK_0>").response(); cookies = resp.cookies(); resp = Http.url("<LINK_0>?enterAgree=1&size=1500") .referrer("<LINK_0>") .cookies(cookies) .response(); cookies.putAll(resp.cookies()); logger.info("grabbing " + "<LINK_3>" + thumb.attr("href")); imagePage = Http.url("<LINK_3>" + thumb.attr("href")).cookies(cookies).get(); } catch (IOException e) { logger.debug(e.getMessage()); logger.debug("Warning: imagePage is null!"); imagePage = null; } if (imagePage.select("div.boxbody > img.center").attr("src").contains("thumbs.") == true) { imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("onclick").replace("this.src=", "").replace("'", "").replace("; $(#resize_message).hide();", "")); } else { imageURLs.add("http:" + imagePage.select("div.boxbody > img.center").attr("src")); } } return imageURLs; }
Source:
public void shouldReturnTrueIfUserCanViewAtLeastOneTemplate() { ArrayList<PipelineTemplateConfig> templateList = new ArrayList<>(); templateList.add(PipelineTemplateConfigMother.createTemplate("template1")); CaseInsensitiveString templateViewUser = new CaseInsensitiveString("template-view"); templateList.add(PipelineTemplateConfigMother.createTemplate("template100", new Authorization(new ViewConfig(new AdminUser(templateViewUser))), StageConfigMother.manualStage("stage-name"))); TemplatesConfig templates = new TemplatesConfig(templateList.toArray(new PipelineTemplateConfig[0])); assertThat(templates.canUserViewTemplates(templateViewUser, null), is(true)); }

Target:
public void shouldReturnTrueIfUserCanViewAtLeastOneTemplate() { CaseInsensitiveString templateViewUser = new CaseInsensitiveString("template-view"); TemplatesConfig templates = configForUserWhoCanViewATemplate(); templates.add(PipelineTemplateConfigMother.createTemplate("template200", new Authorization(new ViewConfig(new AdminUser(templateViewUser))), StageConfigMother.manualStage("stage-name"))); assertThat(templates.canUserViewTemplates(templateViewUser, null, false), is(true)); }
Source:
static int getWatchListCount(final String page) { int count; String sCount = TextUtils.getMatch(page, GCConstants.PATTERN_WATCHLIST_COUNT, true, 1, "notFound", false); if (sCount.equals("notFound")) return -1; try { count = Integer.parseInt(sCount); } catch(NumberFormatException nfe) { Log.i("Could not parse " + nfe); return -1; } return count; }

Target:
static int getWatchListCount(final String page) { final String sCount = TextUtils.getMatch(page, GCConstants.PATTERN_WATCHLIST_COUNT, true, 1, "notFound", false); if (sCount.equals("notFound")) { return -1; } try { return Integer.parseInt(sCount); } catch(final NumberFormatException nfe) { Log.e("Could not parse", nfe); return -1; } }
Source:
protected boolean canAddVm(ArrayList<String> reasons, Collection<storage_domains> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getVmName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmHandler.handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (storage_domains domain : destStorages) { if (validate(new StorageDomainValidator(getStorageDomain()).isDomainWithinThresholds())) { return false; } if (!StorageDomainSpaceChecker.hasSpaceForRequest(domain, getNeededDiskSize(domain.getId()))) { returnValue = false; reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_SPACE_LOW.toString()); break; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }

Target:
protected boolean canAddVm(ArrayList<String> reasons, Collection<storage_domains> destStorages) { VmStatic vmStaticFromParams = getParameters().getVmStaticData(); boolean returnValue = canAddVm(reasons, vmStaticFromParams.getVmName(), getStoragePoolId() .getValue(), vmStaticFromParams.getPriority()); if (returnValue) { List<ValidationError> validationErrors = validateCustomProperties(vmStaticFromParams); if (!validationErrors.isEmpty()) { VmHandler.handleCustomPropertiesError(validationErrors, reasons); returnValue = false; } } if (returnValue && shouldCheckSpaceInStorageDomains()) { if (!getStoragePoolId().equals(getStoragePoolIdFromSourceImageContainer())) { reasons.add(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_POOL_NOT_MATCH.toString()); returnValue = false; } else { for (storage_domains domain : destStorages) { StorageDomainValidator storageDomainValidator = new StorageDomainValidator(domain); if (!validate(storageDomainValidator.isDomainWithinThresholds()) || !validate(storageDomainValidator.isDomainHasSpaceForRequest(getNeededDiskSize(domain.getId())))) { return false; } } } } if (returnValue) { returnValue = isDedicatedVdsOnSameCluster(vmStaticFromParams); } return returnValue; }
Source:
protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Sherpafy"); if (!(getMyApplication().getAppCustomization() instanceof SherpafyCustomization)) { getMyApplication().setAppCustomization(new SherpafyCustomization()); } customization = (SherpafyCustomization) getMyApplication().getAppCustomization(); if (customization.getTourInformations().isEmpty()) { customization.onIndexingFiles(new IProgress() { @Override public void startTask(String taskName, int work) { } @Override public void startWork(int work) { } @Override public void progress(int deltaWork) { } @Override public void remaining(int remainingWork) { } @Override public void finishTask() { } @Override public boolean isIndeterminate() { return false; } @Override public boolean isInterrupted() { return false; } }, new ConcurrentHashMap<String, String>() ); } if (customization.getSelectedTour() == null) { startProgressDialog = new ProgressDialog(this); getMyApplication().checkApplicationIsBeingInitialized(this, startProgressDialog); updateDefaultView(); } else { super.setContentView(R.layout.custom_tour_info); updateTourView(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { ((OsmandApplication) getApplication()).applyTheme(this); super.onCreate(savedInstanceState); getSherlock().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Sherpafy"); if (!(getMyApplication().getAppCustomization() instanceof SherpafyCustomization)) { getMyApplication().setAppCustomization(new SherpafyCustomization()); } customization = (SherpafyCustomization) getMyApplication().getAppCustomization(); ProgressDialog startProgressDialog = new ProgressDialog(this); getMyApplication().checkApplicationIsBeingInitialized(this, startProgressDialog); if (startProgressDialog.isShowing()) { startProgressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { onStartDialogClose(); } }); } else { onStartDialogClose(); } }
Source:
public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; boolean inEscape = false; for (int i = 0; i < script.length(); i++) { char thisChar = script.charAt(i); if (thisChar == '\\') { inEscape = !inEscape; continue; } else if (inEscape) { inEscape = false; continue; } if (thisChar == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }

Target:
public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; boolean inEscape = false; for (int i = 0; i < script.length(); i++) { char c = script.charAt(i); if (c == '\\') { inEscape = !inEscape; continue; } else if (inEscape) { inEscape = false; continue; } if (c == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }
Source:
private void handleDuplicates(DuplicateSearchResult result) { if (result == null) { return; } BasePanel panel = frame.getCurrentBasePanel(); final NamedCompound compoundEdit = new NamedCompound(Localization.lang("duplicate removal")); if (!result.getToRemove().isEmpty()) { compoundEdit.addEdit(new UndoableRemoveEntries(panel.getDatabase(), new ArrayList<>(result.getToRemove()))); panel.getDatabase().removeEntries(new ArrayList<>(result.getToRemove())); panel.markBaseChanged(); } if (!result.getToAdd().isEmpty()) { for (BibEntry entry : result.getToAdd()) { panel.getDatabase().insertEntry(entry); compoundEdit.addEdit(new UndoableInsertEntry(panel.getDatabase(), entry)); } panel.markBaseChanged(); } dialogService.notify(Localization.lang("Duplicates found") + ": " + duplicateCount.get() + ' ' + Localization.lang("pairs processed") + ": " + result.getDuplicateCount()); compoundEdit.end(); panel.getUndoManager().addEdit(compoundEdit); }

Target:
private void handleDuplicates(DuplicateSearchResult result) { if (result == null) { return; } BasePanel panel = frame.getCurrentBasePanel(); final NamedCompound compoundEdit = new NamedCompound(Localization.lang("duplicate removal")); if (!result.getToRemove().isEmpty()) { compoundEdit.addEdit(new UndoableRemoveEntries(panel.getDatabase(), result.getToRemove())); panel.getDatabase().removeEntries(result.getToRemove()); panel.markBaseChanged(); } if (!result.getToAdd().isEmpty()) { for (BibEntry entry : result.getToAdd()) { panel.getDatabase().insertEntry(entry); compoundEdit.addEdit(new UndoableInsertEntry(panel.getDatabase(), entry)); } panel.markBaseChanged(); } dialogService.notify(Localization.lang("Duplicates found") + ": " + duplicateCount.get() + ' ' + Localization.lang("pairs processed") + ": " + result.getDuplicateCount()); compoundEdit.end(); panel.getUndoManager().addEdit(compoundEdit); }
Source:
public void testGetAllelesUnitialized(){ GenotypeLikelihoods.plIndexToAlleleIndices.clear(); final List<Integer> alleles = GenotypeLikelihoods.getAlleles(0, 3); }

Target:
public void testGetAllelesUnitialized() { GenotypeLikelihoods.anyploidPloidyToPLIndexToAlleleIndices.clear(); final List<Integer> alleles = GenotypeLikelihoods.getAlleles(0, 3); }
Source:
private void flushErrorReport(File errorFile) { try { Report report = new Report(config, errorFile); for (BeforeSend beforeSend : config.getBeforeSendTasks()) { try { if (!beforeSend.run(report)) { deleteStoredFiles(Collections.singleton(errorFile)); Logger.info("Deleting cancelled error file " + errorFile.getName()); return; } } catch (Throwable ex) { Logger.warn("BeforeSend threw an Exception", ex); } } config.getDelivery().deliver(report, config); deleteStoredFiles(Collections.singleton(errorFile)); Logger.info("Deleting sent error file " + errorFile.getName()); } catch (DeliveryFailureException exception) { cancelQueuedFiles(Collections.singleton(errorFile)); Logger.warn("Could not send previously saved error(s)" + " to Bugsnag, will try again later", exception); } catch (Exception exception) { deleteStoredFiles(Collections.singleton(errorFile)); Logger.warn("Problem sending unsent error from disk", exception); } }

Target:
private void flushErrorReport(File errorFile) { try { Report report = null; if (config.getBeforeSendTasks().size() > 0) { report = new Report(config.getApiKey(), ErrorReader.readError(config, errorFile)); for (BeforeSend beforeSend : config.getBeforeSendTasks()) { try { if (!beforeSend.run(report)) { deleteStoredFiles(Collections.singleton(errorFile)); Logger.info("Deleting cancelled error file " + errorFile.getName()); return; } } catch (Throwable ex) { Logger.warn("BeforeSend threw an Exception", ex); } } } else { report = new Report(config.getApiKey(), errorFile); } config.getDelivery().deliver(report, config); deleteStoredFiles(Collections.singleton(errorFile)); Logger.info("Deleting sent error file " + errorFile.getName()); } catch (DeliveryFailureException exception) { cancelQueuedFiles(Collections.singleton(errorFile)); Logger.warn("Could not send previously saved error(s)" + " to Bugsnag, will try again later", exception); } catch (Exception exception) { deleteStoredFiles(Collections.singleton(errorFile)); Logger.warn("Problem sending unsent error from disk", exception); } }
Source:
public TableViewerColumn createTableViewerLabelColumn(Object object) { String label = (String) object; int width = 28 + 5 * label.length(); final TableViewerColumn viewerColumn = new TableViewerColumn(fViewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(label); column.setWidth(width); column.setAlignment(SWT.LEFT); column.setResizable(false); column.setMoveable(false); return viewerColumn; }

Target:
public void createTableViewerLabelColumn(Object object) { String label = (String) object; int width = 28 + 5 * label.length(); final TableViewerColumn viewerColumn = new TableViewerColumn(fViewer, SWT.NONE); final TableColumn column = viewerColumn.getColumn(); column.setText(label); column.setWidth(width); column.setAlignment(SWT.LEFT); column.setResizable(false); column.setMoveable(false); }
Source:
public GoalDTO updateGoal(UUID userID, UUID goalID, GoalDTO newGoalDTO, Optional<String> message) { User userEntity = userService.getUserEntityByID(userID); Goal existingGoal = getGoalEntity(userEntity, goalID); verifyGoalUpdate(existingGoal, newGoalDTO); if (newGoalDTO.getCreationTime().isPresent() && !newGoalDTO.isGoalChanged(existingGoal)) { updateGoalCreationTime(userEntity, existingGoal, newGoalDTO); } else if (newGoalDTO.isGoalChanged(existingGoal)) { updateGoal(userEntity, existingGoal, newGoalDTO, message); } return GoalDTO.createInstance(existingGoal); }

Target:
public GoalDTO updateGoal(UUID userID, UUID goalID, GoalDTO newGoalDTO, Optional<String> message) { User userEntity = userService.getUserEntityByID(userID); Goal existingGoal = getGoalEntity(userEntity, goalID); verifyGoalUpdate(existingGoal, newGoalDTO); if (newGoalDTO.getCreationTime().isPresent() && !newGoalDTO.isGoalChanged(existingGoal)) { updateGoalCreationTime(userEntity, existingGoal, newGoalDTO); } else if (newGoalDTO.isGoalChanged(existingGoal)) { assertNoUpdateToThePast(newGoalDTO, existingGoal); updateGoal(userEntity, existingGoal, newGoalDTO, message); } return GoalDTO.createInstance(existingGoal); }
Source:
private void handleSymbol(Symbol symbol) { List<Usage> usages = new ArrayList<>(symbol.usages()); usages.sort(Comparator.comparingInt(u -> u.tree().firstToken().line())); Usage firstUsage = usages.get(0); NewSymbol newSymbol = newSymbolTable.newSymbol(firstUsage.tree().firstToken().line(), firstUsage.tree().firstToken().column(), firstUsage.tree().lastToken().line(), firstUsage.tree().lastToken().column() + firstUsage.tree().lastToken().value().length()); for (int i = 1; i < usages.size(); i++) { Usage usage = usages.get(i); newSymbol.newReference(usage.tree().firstToken().line(), usage.tree().firstToken().column(), usage.tree().lastToken().line(), usage.tree().lastToken().column() + firstUsage.tree().lastToken().value().length()); } }

Target:
private void handleSymbol(Symbol symbol) { List<Usage> usages = new ArrayList<>(symbol.usages()); usages.sort(Comparator.comparingInt(u -> u.tree().firstToken().line())); Tree firstUsageTree = usages.get(0).tree(); NewSymbol newSymbol = newSymbolTable.newSymbol(firstUsageTree.firstToken().line(), firstUsageTree.firstToken().column(), firstUsageTree.lastToken().line(), firstUsageTree.lastToken().column() + firstUsageTree.lastToken().value().length()); for (int i = 1; i < usages.size(); i++) { Tree usageTree = usages.get(i).tree(); newSymbol.newReference(usageTree.firstToken().line(), usageTree.firstToken().column(), usageTree.lastToken().line(), usageTree.lastToken().column() + usageTree.lastToken().value().length()); } }
Source:
private String computeUsername(MailAddress recipient) throws MessagingException { try { return usersRepository.getUser(recipient); } catch (UsersRepositoryException e) { if (LOGGER.isWarnEnabled()) { LOGGER.warn("Unable to retrieve username for " + recipient.asPrettyString(), e); } return recipient.toString(); } }

Target:
private String computeUsername(MailAddress recipient) throws MessagingException { try { return usersRepository.getUser(recipient); } catch (UsersRepositoryException e) { LOGGER.warn("Unable to retrieve username for {}", recipient.asPrettyString(), e); return recipient.toString(); } }
Source:
public void helloWorld() throws Exception { GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins); sc.open(); { MockSecurityRealm ms = sc.useRealm(MockSecurityRealm.class); ms.configure("alice","bob"); MatrixAuthorizationStrategy mas = sc.useAuthorizationStrategy(MatrixAuthorizationStrategy.class); MatrixRow a = mas.addUser("alice"); a.admin(); MatrixRow bob = mas.addUser("bob"); bob.on(OVERALL_READ); } sc.save(); jenkins.login().doLogin("alice"); FreeStyleJob j = jenkins.jobs.create(); j.save(); jenkins.login().doLogin("bob"); waitFor(by.id("main-panel")); assertNull(getElement(by.href("job/"+j.name+"/"))); jenkins.login().doLogin("alice"); waitFor(by.id("main-panel")); assertNotNull(getElement(by.href("job/"+j.name+"/"))); }

Target:
public void helloWorld() throws Exception { GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins); sc.open(); { MockSecurityRealm ms = sc.useRealm(MockSecurityRealm.class); ms.configure("alice","bob"); MatrixAuthorizationStrategy mas = sc.useAuthorizationStrategy(MatrixAuthorizationStrategy.class); MatrixRow a = mas.addUser("alice"); a.admin(); MatrixRow bob = mas.addUser("bob"); bob.on(OVERALL_READ); } sc.save(); jenkins.login().doLogin("alice"); FreeStyleJob j = jenkins.jobs.create(); j.save(); jenkins.logout(); jenkins.login().doLogin("bob"); assertFalse(j.open().getTitle().contains(j.name)); jenkins.logout(); jenkins.login().doLogin("alice"); assertTrue(j.open().getTitle().contains(j.name)); }
Source:
private User mapParticipationDto(ParticipationDto dto){ User user = new User(); user.setUsername(dto.getName()); user.setPassword(dto.getPassword()); user.setEmail(dto.getUuid() + "@cod.uno"); return user; }

Target:
private User mapParticipationDto(ParticipationDto dto) { User user = new User(); user.setId(UUID.fromString(dto.getUuid())); user.setUsername(dto.getName()); user.setPassword(dto.getPassword()); user.setEmail(dto.getEmail()); return user; }
Source:
public java.util.List<String> getTooltipStrings(int mouseX, int mouseY) { if (mouseX > 67 && mouseX < 107 && mouseY > 18 && mouseY < 38) { return Collections.singletonList("Click in world, shift click for second output"); } return Collections.emptyList(); }

Target:
public java.util.List<String> getTooltipStrings(int mouseX, int mouseY) { if (mouseX > 67 && mouseX < 107 && mouseY > 18 && mouseY < 38) { return Collections.singletonList(I18n.format("pe.nei.worldtransmute.description")); } return Collections.emptyList(); }
Source:
public String toString() { return getClass().getSimpleName()+"["+ (Strings.isNonBlank(publicKeyData) ? publicKeyData : "public-key")+";"+ (Strings.isNonBlank(privateKeyData) ? "private-key" : "private-key")+","+ (password!=null ? "password(len="+password.length()+")" : "no-password")+"]"; }

Target:
public String toString() { return getClass().getSimpleName()+"["+ (Strings.isNonBlank(publicKeyData) ? publicKeyData : "no-public-key")+";"+ (Strings.isNonBlank(privateKeyData) ? "private-key-present" : "no-private-key")+","+ (password!=null ? "password(len="+password.length()+")" : "no-password")+"]"; }
Source:
protected StorageHelper getStorageHelper() { synchronized (sLock) { if (sHelper == null) { Logger.v(TAG, "Started to initialize storage helper"); sHelper = new StorageHelper(mContext); Logger.v(TAG, "Finished to initialize storage helper"); } } return sHelper; }

Target:
protected synchronized StorageHelper getStorageHelper() { if (sHelper == null) { Logger.v(TAG, "Started to initialize storage helper"); sHelper = new StorageHelper(mContext); Logger.v(TAG, "Finished to initialize storage helper"); } return sHelper; }
Source:
private TargetedSweeper initializeAndGet(TargetedSweeper sweeper, TransactionManager txManager) { sweeper.initialize( new SpecialTimestampsSupplier(txManager::getImmutableTimestamp, txManager::getImmutableTimestamp), txManager.getLockService(), txManager.getKeyValueService(), new TargetedSweepFollower(ImmutableList.of(FOLLOWER), txManager)); return sweeper; }

Target:
private TargetedSweeper initializeAndGet(TargetedSweeper sweeper, TransactionManager txManager) { sweeper.initialize( new SpecialTimestampsSupplier(txManager::getImmutableTimestamp, txManager::getImmutableTimestamp), txManager.getTimelockService(), txManager.getKeyValueService(), new TargetedSweepFollower(ImmutableList.of(FOLLOWER), txManager)); return sweeper; }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getParam()); extensionHook.addSessionListener(this); extensionHook.addSiteMapListener(this); extensionHook.addHttpSenderListener(this); if (getView() != null) { extensionHook.getHookView().addStatusPanel(getHttpSessionsPanel()); extensionHook.getHookView().addOptionPanel(getOptionsHttpSessionsPanel()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuSetActiveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuUnsetActiveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuRemoveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuAddUserFromSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuItemCopySessionToken()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuItemFindRelatedMessages()); } extensionHook.addApiImplementor(new HttpSessionsAPI(this)); }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addOptionsParamSet(getParam()); extensionHook.addSessionListener(this); extensionHook.addSiteMapListener(this); extensionHook.addHttpSenderListener(this); if (getView() != null) { extensionHook.getHookView().addStatusPanel(getHttpSessionsPanel()); extensionHook.getHookView().addOptionPanel(getOptionsHttpSessionsPanel()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuSetActiveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuUnsetActiveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuRemoveSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuAddUserFromSession()); extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuItemCopySessionToken()); if (Control.getSingleton().getExtensionLoader().getExtension(ExtensionSearch.class) != null) { extensionHook.getHookMenu().addPopupMenuItem(getPopupMenuItemFindRelatedMessages()); } } extensionHook.addApiImplementor(new HttpSessionsAPI(this)); }
Source:
public static boolean isMafFile(String file) { return Pattern.matches("^[\\w\\-\\./]+.maf$", file); }

Target:
public static boolean isMafFile(String file) { return Pattern.matches("^[\\w\\-\\./]+(\\.maf)|^[\\w\\-\\./]+(\\.tsv)|^[\\w\\-\\./]+(\\.txt)$$", file); }
Source:
public void testAnnotationIsDefault() { loadTheDefaultCatalog(); int numInDefault = Iterables.size(defaultCatalog.getCatalogItems(Predicates.alwaysTrue())); loadAnnotationsOnlyCatalog(); int numFromAnnots = Iterables.size(annotsCatalog.getCatalogItems(Predicates.alwaysTrue())); Assert.assertEquals(numInDefault, numFromAnnots); }

Target:
public void testAnnotationIsDefault() { doTestAnnotationIsDefault(false); }
Source:
protected void processEvent(EventObject event) { Assert.notNull(event, "event must not be null"); if (getCacheEventTypeSet().contains(((AbstractIMapEvent) event).getEventType().toString())) { sendMessage(event, ((AbstractIMapEvent) event).getMember().getSocketAddress(), getCacheListeningPolicy()); } }

Target:
protected void processEvent(EventObject event) { Assert.notNull(event, "event must not be null"); if (getCacheEvents().contains(((AbstractIMapEvent) event).getEventType().toString())) { sendMessage(event, ((AbstractIMapEvent) event).getMember().getSocketAddress(), getCacheListeningPolicy()); } if (logger.isDebugEnabled()){ logger.debug("Received Event : " + event); } }
Source:
public void testEventHandlerDependencies() throws InterruptedException { final Context context = new Context(ServiceNeedingAnEventService.class); final EventService eventService = context.getService(EventService.class); final ServiceNeedingAnEventService snaeService = context.getService(ServiceNeedingAnEventService.class); assertNotNull(eventService); Thread.sleep(500); assertTrue(snaeService.isContextCreated()); }

Target:
public void testEventHandlerDependencies() throws InterruptedException { final Context context = new Context(ServiceNeedingAnEventService.class); final EventService eventService = context.getService(EventService.class); final ServiceNeedingAnEventService snaeService = context.getService(ServiceNeedingAnEventService.class); assertNotNull(eventService); synchronized (snaeService) { snaeService.wait(500); } assertTrue(snaeService.isContextCreated()); }
Source:
public void testKleinbergBurstDetection() { assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[1.1])", new ArrayType(IntegerType.INTEGER), null); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 100.1, 101, 110, 110.1, 110.2, 110.3, 110.35, 110.40, 150, 304.35])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 100.1, 101, 110, 110.1, 110.2, 110.3, 110.35, 110.40, 150, 304.35], 2.0, 1.0)", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 101, 110, 111, 112, 113, 114, 115, 150, 304])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 3, 3, 3, 3, 3, 0, 0)); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[110.40, 110.35])", new ArrayType(IntegerType.INTEGER), null); assertFunction( "KLEINBERG_BURST_DETECTION(" + "ARRAY[CAST(100 as REAL), " + "CAST(100.1 as REAL), " + "CAST(101 as REAL), " + "CAST(110 as REAL), " + "CAST(110.1 as REAL), " + "CAST(110.2 as REAL), " + "CAST(110.3 as REAL), " + "CAST(110.35 as REAL), " + "CAST(110.40 as REAL), " + "CAST(150 as REAL), " + "CAST(304.35 as REAL)])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); }

Target:
public void testKleinbergBurstDetection() { assertInvalidFunction( "KLEINBERG_BURST_DETECTION(ARRAY[1.1])", INVALID_FUNCTION_ARGUMENT, "time series must have at least two values"); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 100.1, 101, 110, 110.1, 110.2, 110.3, 110.35, 110.40, 150, 304.35])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 100.1, 101, 110, 110.1, 110.2, 110.3, 110.35, 110.40, 150, 304.35], 2.0, 1.0)", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); assertFunction( "KLEINBERG_BURST_DETECTION(ARRAY[100, 101, 110, 111, 112, 113, 114, 115, 150, 304])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 3, 3, 3, 3, 3, 0, 0)); assertInvalidFunction( "KLEINBERG_BURST_DETECTION(ARRAY[110.40, 110.35])", INVALID_FUNCTION_ARGUMENT, "time series must be sorted in ascending order"); assertFunction( "KLEINBERG_BURST_DETECTION(" + "ARRAY[REAL '100', " + "REAL '100.1', " + "REAL '101', " + "REAL '110', " + "REAL '110.1', " + "REAL '110.2', " + "REAL '110.3', " + "REAL '110.35', " + "REAL '110.40', " + "REAL '150', " + "REAL '304.35'])", new ArrayType(IntegerType.INTEGER), ImmutableList.of(0, 2, 2, 2, 6, 6, 6, 6, 6, 0, 0)); }
Source:
private ArrayList<MediaOption> initOtherMediaAudioFileOptions() { ArrayList<MediaOption> otherMediaOptions = new ArrayList<>(); FragmentActivity activity = getActivity(); if (activity == null) { AppLog.e(T.EDITOR, "Failed to initialize other media options because the activity is null"); return otherMediaOptions; } String packageName = activity.getApplication().getPackageName(); int chooseAudioFileResourceId = getResources().getIdentifier("photo_picker_choose_file", "string", packageName); otherMediaOptions.add(new MediaOption(MEDIA_SOURCE_AUDIO_FILE, getString(chooseAudioFileResourceId))); return otherMediaOptions; }

Target:
private ArrayList<MediaOption> initOtherMediaAudioFileOptions() { return initOtherMediaFileOptions(MEDIA_SOURCE_AUDIO_FILE); }
Source:
protected void onInitialize() { super.onInitialize(); add(new AjaxEventBehavior("onclick") { @Override protected void onEvent(AjaxRequestTarget target) { popoverPanel.getContentModel().setObject(getContentModel().getObject()); popoverPanel.getTitleModel().setObject(getTitleModel().getObject()); popoverPanel.setPosition(positionModel.getObject()); popoverPanel.setPlacement(getPlacementModel().getObject()); popoverPanel.setPositioning(DEFAULT_POSITIONING); popoverPanel.show(target); } }); }

Target:
protected void onInitialize() { super.onInitialize(); add(new AjaxEventBehavior("click") { @Override protected void onEvent(AjaxRequestTarget target) { popoverPanel.getContentModel().setObject(getContentModel().getObject()); popoverPanel.getTitleModel().setObject(getTitleModel().getObject()); popoverPanel.setPosition(positionModel.getObject()); popoverPanel.setPlacement(getPlacementModel().getObject()); popoverPanel.setPositioning(DEFAULT_POSITIONING); popoverPanel.show(target); } }); }
Source:
public void writeFrom(ReadableByteChannel channel, long offset, long size) throws IOException { int sizeRead = 0; ByteBuffer buffer = buflist.get(index); while (sizeRead < size) { sizeRead += channel.read(buffer); } index++; }

Target:
public void writeFrom(ReadableByteChannel channel, long offset, long size) throws IOException { throw new IllegalArgumentException("Not implemented"); }
Source:
public SELF isEqualTo(Object... values) { if(!recursiveComparisonConfiguration.getAllowArrayTypeForExpected()) throw new AssertionError("Type array is not acceptable when comparing iterables, try calling #allowingArrayTypeForExpected configuration."); return isEqualTo(Arrays.asList(values)); }

Target:
public SELF isEqualTo(Object... values) { if(!recursiveComparisonConfiguration.getAllowComparingIterableWithArray()) throw new AssertionError("By default Iterable can't be compared to array, call allowingComparingIterableWithArray to allow it."); return isEqualTo(list(values)); }
Source:
public static String getMetadataForDeactivateIdentifier(String identifier, Map<String, String> metadata, DvObject dvObject) { System.out.print("Start of getMetadataForDeactivateIdentifier: "); DataCiteMetadataTemplate metadataTemplate = new DataCiteMetadataTemplate(); metadataTemplate.setIdentifier(identifier.substring(identifier.indexOf(':') + 1)); metadataTemplate.setCreators(Util.getListFromStr(metadata.get("datacite.creator"))); metadataTemplate.setDescription(":unav"); String title =metadata.get("datacite.title"); System.out.print("Map metadata title: "+ metadata.get("datacite.title")); metadataTemplate.setAuthors(null); metadataTemplate.setTitle(title); String producerString = ":unav"; metadataTemplate.setPublisher(producerString); metadataTemplate.setPublisherYear(metadata.get("datacite.publicationyear")); String xmlMetadata = metadataTemplate.generateXML(dvObject); logger.log(Level.FINE, "XML to send to DataCite: {0}", xmlMetadata); return xmlMetadata; }

Target:
public static String getMetadataForDeactivateIdentifier(String identifier, Map<String, String> metadata, DvObject dvObject) { DataCiteMetadataTemplate metadataTemplate = new DataCiteMetadataTemplate(); metadataTemplate.setIdentifier(identifier.substring(identifier.indexOf(':') + 1)); metadataTemplate.setCreators(Util.getListFromStr(metadata.get("datacite.creator"))); metadataTemplate.setDescription(AbstractGlobalIdServiceBean.UNAVAILABLE); String title =metadata.get("datacite.title"); System.out.print("Map metadata title: "+ metadata.get("datacite.title")); metadataTemplate.setAuthors(null); metadataTemplate.setTitle(title); String producerString = AbstractGlobalIdServiceBean.UNAVAILABLE; metadataTemplate.setPublisher(producerString); metadataTemplate.setPublisherYear(metadata.get("datacite.publicationyear")); String xmlMetadata = metadataTemplate.generateXML(dvObject); logger.log(Level.FINE, "XML to send to DataCite: {0}", xmlMetadata); return xmlMetadata; }
Source:
synchronized void prepareDataForEpoch() { trainingDataKeySet.addAll(memoryStore.getAll().keySet()); LOG.log(Level.INFO, "training data key set size = " + trainingDataKeySet.size()); }

Target:
public synchronized void prepareDataForEpoch() { trainingDataKeySet.addAll(memoryStore.getAll().keySet()); LOG.log(Level.INFO, "training data key set size = {0}", trainingDataKeySet.size()); }
Source:
public void onDraw(Canvas canvas) { if (super.text.get() == null) { super.text.set(""); } super.lastFont = canvas.getCurrentStyle().getFont(); super.lastWidth = (int) (canvas.size().x * 0.8f); if (isEnabled()) { canvas.addInteractionRegion(super.interactionListener, Rect2i.createFromMinAndMax(0, 0, (int) (canvas.size().x * 0.8f), canvas.size().y)); clearButton.subscribe(new ActivateEventListener() { @Override public void onActivated(UIWidget widget) { setText(""); } }); } clearButton.setEnabled(isEnabled()); correctCursor(); int widthForDraw = (super.multiline) ? (int) (canvas.size().x * 0.8f) : super.lastFont.getWidth(getText()); try (SubRegion ignored = canvas.subRegion(canvas.getRegion(), true); SubRegion ignored2 = canvas.subRegion(Rect2i.createFromMinAndSize(-super.offset, 0, widthForDraw + 1, Integer.MAX_VALUE), false)) { canvas.drawText(super.text.get(), canvas.getRegion()); if (isFocused()) { if (hasSelection()) { drawSelection(canvas); } else { drawCursor(canvas); } } } Rect2i buttonRegion = Rect2i.createFromMinAndMax((int) (canvas.size().x * 0.8f), 0, canvas.size().x, canvas.size().y); canvas.drawWidget(clearButton, buttonRegion); }

Target:
public void onDraw(Canvas canvas) { Rect2i clearButtonRegion = Rect2i.createFromMinAndSize(0, 0, 30, canvas.size().y); if (text.get() == null) { text.set(""); } lastFont = canvas.getCurrentStyle().getFont(); lastWidth = canvas.size().x - clearButtonRegion.size().x; if (isEnabled()) { canvas.addInteractionRegion(interactionListener, Rect2i.createFromMinAndMax(0, 0, canvas.size().x, canvas.size().y)); canvas.addInteractionRegion(clearInteractionListener, Rect2i.createFromMinAndMax(canvas.size().x, 0, canvas.size().x + clearButtonRegion.size().x, canvas.size().y)); } correctCursor(); int widthForDraw = (multiline) ? canvas.size().x - clearButtonRegion.size().x : lastFont.getWidth(getText()); try (SubRegion ignored = canvas.subRegion(canvas.getRegion(), true); SubRegion ignored2 = canvas.subRegion(Rect2i.createFromMinAndSize(-offset, 0, widthForDraw + 1, Integer.MAX_VALUE), false)) { canvas.drawText(text.get(), canvas.getRegion()); if (isFocused()) { if (hasSelection()) { drawSelection(canvas); } else { drawCursor(canvas); } } } }