auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public JSONObject getIdentitiesBySearch(@RequestBody JSONObject identitiesSearches, HttpServletResponse response) throws IOException { if (identitiesSearches.size() == 0) { throw new RestException("Must give search terms to look up identities"); } Integer requestCounter = (Integer) identitiesSearches.get("requestCounter"); JSONArray searchTerms = JSONArray.fromObject(identitiesSearches.get("identitiesSearches")); List<Set<SampleDto>> foundIdentities = new ArrayList<Set<SampleDto>>(); for (int i = 0; i < searchTerms.size(); i++) { Set<Sample> resultsForOneParent = new HashSet<Sample>(); Set<SampleDto> resultsForOneParentDtos = new HashSet<SampleDto>(); for (String term : IdentityImpl.getSetFromString(((String) searchTerms.get(i)).replaceAll(";", ","))) { Collection<Identity> selectedIdentities = sampleService.getIdentitiesByExternalNameOrAlias(term); <START> if (!selectedIdentities.isEmpty()) { <END> for (Identity selectedIdentity : selectedIdentities) { if (resultsForOneParent.contains(selectedIdentity)) { continue; } else { resultsForOneParentDtos.add(Dtos.asDto(selectedIdentity)); resultsForOneParent.add(selectedIdentity); } } } } foundIdentities.add(resultsForOneParentDtos); } JSONObject allIdentities = new JSONObject(); allIdentities.put("requestCounter", requestCounter); allIdentities.put("foundIdentities", foundIdentities); return allIdentities; }</code><technical_language>This if is redundant. loop cover empty set</technical_language>

Target:
public JSONObject getIdentitiesBySearch(@RequestBody JSONObject identitiesSearches, HttpServletResponse response) throws IOException { if (identitiesSearches.size() == 0) { throw new RestException("Must give search terms to look up identities"); } Integer requestCounter = (Integer) identitiesSearches.get("requestCounter"); List<Set<SampleDto>> identitiesResults = new ArrayList<>(); JSONArray searchTerms = JSONArray.fromObject(identitiesSearches.get("identitiesSearches")); for (int i = 0; i < searchTerms.size(); i++) { Set<Sample> resultsForOneParent = new HashSet<>(); Set<SampleDto> resultsForOneParentDtos = new HashSet<>(); for (String term : IdentityImpl.getSetFromString(((String) searchTerms.get(i)).replaceAll(";", ","))) { Collection<Identity> selectedIdentities = sampleService.getIdentitiesByExternalNameOrAlias(term); for (Identity selectedIdentity : selectedIdentities) { if (resultsForOneParent.contains(selectedIdentity)) { continue; } else { resultsForOneParentDtos.add(Dtos.asDto(selectedIdentity)); resultsForOneParent.add(selectedIdentity); } } } identitiesResults.add(resultsForOneParentDtos); } JSONObject allIdentities = new JSONObject(); allIdentities.put("requestCounter", requestCounter); allIdentities.put("identitiesResults", identitiesResults); return allIdentities; }
Source:
<code>public static byte[] decrypt(Request request) throws OSException { discardEOptions(request); OSCoreCtxDB db = HashMapCtxDB.getInstance(); byte[] protectedData = collectData(request); Encrypt0Message enc = decompression(protectedData, request); CBORObject kid = enc.findAttribute(HeaderKeys.KID); if (kid == null || !kid.getType().equals(CBORType.ByteString)) { LOGGER.severe(OSExceptionHandler.MISSING_KID); throw new OSException(OSExceptionHandler.MISSING_KID); } byte[] rid = kid.GetByteString(); OSCoreCtx ctx = db.getContext(rid); if (ctx == null) { LOGGER.severe(OSExceptionHandler.CONTEXT_NOT_FOUND); throw new OSException(OSExceptionHandler.CONTEXT_NOT_FOUND); } <START> byte[] plaintext = new byte[0]; <END> plaintext = decryptAndDecode(enc, request, ctx, null); ctx.setCoAPCode(Code.valueOf(plaintext[0])); plaintext = Arrays.copyOfRange(plaintext, 1, plaintext.length); OptionSet optionSet = OptionJuggle.readOptionsFromOSPayload(plaintext); request.setOptions(optionSet); byte[] payload = OSSerializer.readPayload(plaintext); request.setPayload(payload); return rid; }</code><technical_language>initialize result of line below, create useless GC stress</technical_language>

Target:
public static Request decrypt(Request request) throws CoapOSException { discardEOptions(request); OSCoreCtxDB db = HashMapCtxDB.getInstance(); byte[] protectedData = request.getPayload(); Encrypt0Message enc; OptionSet uOptions = request.getOptions(); try { enc = decompression(protectedData, request); } catch (OSException e) { LOGGER.error(Error.FAILED_TO_DECODE_COSE); throw new CoapOSException(Error.FAILED_TO_DECODE_COSE, ResponseCode.BAD_OPTION); } CBORObject kid = enc.findAttribute(HeaderKeys.KID); if (kid == null || !kid.getType().equals(CBORType.ByteString)) { LOGGER.error(Error.MISSING_KID); throw new CoapOSException(Error.FAILED_TO_DECODE_COSE, ResponseCode.BAD_OPTION); } byte[] rid = kid.GetByteString(); OSCoreCtx ctx = db.getContext(rid); if (ctx == null) { LOGGER.error(Error.CONTEXT_NOT_FOUND); throw new CoapOSException(Error.CONTEXT_NOT_FOUND, ResponseCode.UNAUTHORIZED); } byte[] plaintext; try { plaintext = decryptAndDecode(enc, request, ctx, null); } catch (OSException e) { LOGGER.error(Error.DECRYPTION_FAILED); throw new CoapOSException(Error.DECRYPTION_FAILED, ResponseCode.BAD_REQUEST); } DatagramReader reader = new DatagramReader(new ByteArrayInputStream(plaintext)); ctx.setCoAPCode(Code.valueOf(reader.read(CoAP.MessageFormat.CODE_BITS))); request.setOptions(EMPTY); DataParser.parseOptionsAndPayload(reader, request); OptionSet eOptions = request.getOptions(); eOptions = OptionJuggle.merge(eOptions, uOptions); request.setOptions(eOptions); request.getOptions().setOscore(rid); return OptionJuggle.setRealCodeRequest(request, ctx.getCoAPCode()); }
Source:
<code>private String toString(String title, String text) { StringBuilder result = new StringBuilder(); result.append("Hint"); if (title != null) result.append(".titled(\"").append(title).append("\")"); if (effort != 0) result.append(".withEffort(").append(effort).append(")"); if (tags != null && !tags.isEmpty()) result.append(".withTags(").append(tags).append(")"); if (text != null) result.append("\n\t.withText(\"").append(StringUtils.abbreviate(text.trim(), MAX_LOG_TEXT_LENGTH)).append("\")"); if (links != null && !links.isEmpty()) <START> result.append("\n\t.with(").append(links).append(")"); <END> return result.toString(); }</code><technical_language>is System.lineSeparator() instead of \n OS</technical_language>

Target:
private String toString(String title, String text) { StringBuilder result = new StringBuilder(); result.append("Hint"); if (title != null) result.append(".titled(\"").append(title).append("\")"); if (effort != 0) result.append(".withEffort(").append(effort).append(")"); if (tags != null && !tags.isEmpty()) result.append(".withTags(").append(tags).append(")"); if (text != null) result.append(Util.NL + "\t.withText(\"").append(StringUtils.abbreviate(text.trim(), MAX_LOG_TEXT_LENGTH)).append("\")"); if (links != null && !links.isEmpty()) result.append(Util.NL + "\t.with(").append(links).append(")"); return result.toString(); }
Source:
<code>public void edit(HostNetworkProviderModel model) { driver.edit(model); final NeutronAgentModel neutronAgentModel = model.getNeutronAgentModel(); neutronAgentWidget.edit(neutronAgentModel); neutronAgentPanel.setVisible(neutronAgentModel.isPluginConfigurationAvailable().getEntity()); <START> model.getNetworkProviderType().getSelectedItemChangedEvent().addListener((ev, sender, args) -> <END> neutronAgentPanel.setVisible(model.getNetworkProviderType().getSelectedItem() == OPENSTACK_NETWORK)); }</code><technical_language>neutron agent panel visible if: - type is OPENSTACK_NETWORK - plugin_type is OPEN_VSWITCH this set visible type == OPENSTACK, of plugin_type is</technical_language>

Target:
public void edit(HostNetworkProviderModel model) { driver.edit(model); final NeutronAgentModel neutronAgentModel = model.getNeutronAgentModel(); neutronAgentWidget.edit(neutronAgentModel); neutronAgentPanel.setVisible(neutronAgentModel.isPluginConfigurationAvailable().getEntity()); IEventListener<EventArgs> providerPluginTypeListener = (ev, sender, args) -> neutronAgentPanel.setVisible( model.getNetworkProviderType().getSelectedItem() == OPENSTACK_NETWORK && isOpenstackPlugin(model.getProviderPluginType().getSelectedItem())); model.getNetworkProviderType().getSelectedItemChangedEvent().addListener(providerPluginTypeListener); model.getProviderPluginType().getSelectedItemChangedEvent().addListener(providerPluginTypeListener); }
Source:
<code>public CloudnameException() { <START> super(); <END> }</code><technical_language>Redundant, remove</technical_language>

Target:
public CloudnameException() { }
Source:
<code>public KubernetesCloud(@NonNull String name, @NonNull KubernetesCloud source) { super(name); this.defaultsProviderTemplate = source.defaultsProviderTemplate; this.templates.addAll(source.templates); this.serverUrl = source.serverUrl; <START> this.serverCertificate = source.serverCertificate; <END> this.skipTlsVerify = source.skipTlsVerify; this.addMasterProxyEnvVars = source.addMasterProxyEnvVars; this.namespace = source.namespace; this.directConnection = source.directConnection; this.jenkinsUrl = source.jenkinsUrl; this.jenkinsTunnel = source.jenkinsTunnel; this.credentialsId = source.credentialsId; this.containerCap = source.containerCap; this.retentionTimeout = source.retentionTimeout; this.connectTimeout = source.connectTimeout; this.readTimeout = source.readTimeout; this.usageRestricted = source.usageRestricted; this.maxRequestsPerHost = source.maxRequestsPerHost; this.podRetention = source.podRetention; this.waitForPodSec = source.waitForPodSec; this.capOnlyOnAlivePods = source.capOnlyOnAlivePods; setPodLabels(source.podLabels); }</code><technical_language>I suggest XStream do copy, in #608</technical_language>

Target:
public KubernetesCloud(@NonNull String name, @NonNull KubernetesCloud source) { super(name); XStream2 xs = new XStream2(); xs.omitField(Cloud.class, "name"); xs.omitField(KubernetesCloud.class, "templates"); xs.unmarshal(XStream2.getDefaultDriver().createReader(new StringReader(xs.toXML(source))), this); this.templates.addAll(source.templates); }
Source:
<code><START> public VersionTreeDialog(Active active, Collection<IAtsVersion> versions) { <END> super("Select Version", "Select Version", new VersionContentProvider(active), new AtsObjectLabelProvider(), new AtsObjectNameSorter()); setInput(versions); }</code><technical_language>ArrayTreeContentProvider instead of creating new VersionContentProvider</technical_language>

Target:
public VersionTreeDialog(Active active, Collection<IAtsVersion> versions) { super("Select Version", "Select Version", new ArrayTreeContentProvider(), new AtsObjectLabelProvider(), new AtsObjectNameSorter()); setInput(versions); }
Source:
<code>public void build() throws Exception { if (keyPassword == null) { <START> throw new IllegalStateException("keyPassword has to be specified"); <END> } if (storagePassword == null) { throw new IllegalStateException("storagePassword has to be specified"); } if (file == null) { throw new IllegalStateException("file has to be specified"); } KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(null, null); KeyGenerator generator = KeyGenerator.getInstance(cryptoAlgorithm); generator.init(keySize); SecretKey adminKey = generator.generateKey(); KeyStore.ProtectionParameter keyPP = new KeyStore.PasswordProtection(keyPassword); keyStore.setEntry(KeystorePasswordStore.DEFAULT_ADMIN_KEY_ALIAS, new KeyStore.SecretKeyEntry(adminKey), keyPP); Cipher cipher = Cipher.getInstance(cryptoAlgorithm); cipher.init(Cipher.ENCRYPT_MODE, adminKey); for (Data d : data) { byte[] plainData = Normalizer.normalize(new String(d.getSecret()), Normalizer.Form.NFKC).getBytes(StandardCharsets.UTF_8); byte[] encryptedData = cipher.doFinal(plainData); KeystorePasswordStore.Entry entry = new KeystorePasswordStore.Entry(PasswordCredential.class.getName(), encryptedData); keyStore.setEntry(d.getAlias(), new KeyStore.SecretKeyEntry(new SecretKeyWrap(entry)), keyPP); } keyStore.store(new FileOutputStream(file), storagePassword); }</code><technical_language>Ah I missed that. Sorry</technical_language>

Target:
public void build() throws Exception { if (keyPassword == null) { throw new IllegalStateException("keyPassword has to be specified"); } if (storagePassword == null) { throw new IllegalStateException("storagePassword has to be specified"); } if (file == null) { throw new IllegalStateException("file has to be specified"); } KeyStore keyStore = KeyStore.getInstance(type); keyStore.load(null, null); KeyGenerator generator = KeyGenerator.getInstance(cryptoAlgorithm); generator.init(keySize); SecretKey adminKey = generator.generateKey(); KeyStore.ProtectionParameter keyPP = new KeyStore.PasswordProtection(keyPassword); keyStore.setEntry(KeystorePasswordStore.DEFAULT_ADMIN_KEY_ALIAS, new KeyStore.SecretKeyEntry(adminKey), keyPP); Cipher cipher = Cipher.getInstance(cryptoAlgorithm); cipher.init(Cipher.ENCRYPT_MODE, adminKey); for (Data d : data) { byte[] plainData = Normalizer.normalize(new String(d.getSecret()), Normalizer.Form.NFKC).getBytes(StandardCharsets.UTF_8); byte[] encryptedData = cipher.doFinal(plainData); KeystorePasswordStore.Entry entry = new KeystorePasswordStore.Entry(PasswordCredential.class.getName(), encryptedData); keyStore.setEntry(d.getAlias(), new KeyStore.SecretKeyEntry(new SecretKeyWrap(KeystorePasswordStore.Entry.serializeEntry(entry), ClearPassword.ALGORITHM_CLEAR)), keyPP); } keyStore.store(new FileOutputStream(file), storagePassword); }
Source:
<code>public E getRandomValue() throws NoSuchElementException { List<E> enumConstants = getFilteredList(); <START> if (enumConstants.isEmpty()) { <END> throw new NoSuchElementException("No enum element available for random picking."); } int randomIndex = random.nextInt(enumConstants.size()); return enumConstants.get(randomIndex); }</code><technical_language>this checked construction time. If guy is excluding values enum, throw a beautiful IllegalArgumentException. Hence, getRandomValue declare throwing NoSuchElementException</technical_language>

Target:
public E getRandomValue() { List<E> enumConstants = getFilteredList(); int randomIndex = random.nextInt(enumConstants.size()); return enumConstants.get(randomIndex); }
Source:
<code>public final Object include(final String filename) { final Object file = ResourceTools.resolveFile(filename, getScriptEngine().getExecutedFile(), true); if (file != null) <START> return getScriptEngine().inject(new Script(filename, file)); <END> else { try { final URL url = new URL(filename); return getScriptEngine().inject(url.openStream()); } catch (final MalformedURLException e) { } catch (final IOException e) { } } throw new RuntimeException("Cannot locate '" + filename + "'"); }</code><technical_language>if Script constructor job, do need change (also this other locations, constructor is place go)</technical_language>

Target:
public final Object include(final String filename) { final Object file = ResourceTools.resolveFile(filename, getScriptEngine().getExecutedFile(), true); if (file != null) return getScriptEngine().inject(file); else { try { final URL url = new URL(filename); return getScriptEngine().inject(url.openStream()); } catch (final MalformedURLException e) { } catch (final IOException e) { } } throw new RuntimeException("Cannot locate '" + filename + "'"); }
Source:
<code>public boolean validateSegments(List<DataSegment> latestSegments) { final List<String> thoseSegments = latestSegments .stream() .map(segment -> segment.getId().toString()) .collect(Collectors.toList()); <START> Collections.sort(this.segments); <END> Collections.sort(thoseSegments); return this.segments.equals(thoseSegments); }</code><technical_language>sort this.segments is initialized? a Set work</technical_language>

Target:
public boolean validateSegments(List<DataSegment> latestSegments) { final List<String> thoseSegments = latestSegments .stream() .map(segment -> segment.getId().toString()) .sorted() .collect(Collectors.toList()); return this.segments.equals(thoseSegments); }
Source:
<code>public void onReceive(Context context, Intent intent) { News news = Parcels.unwrap(intent.getParcelableExtra(Constants.NEWS)); <START> Intent chooser = Intent.createChooser(ActionUtil.getPumpkinShareIntent(context, news), "Share"); <END> chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(chooser); }</code><technical_language>call ActionUtil.share</technical_language>

Target:
public void onReceive(Context context, Intent intent) { News news = Parcels.unwrap(intent.getParcelableExtra(Constants.NEWS)); String label = context.getResources().getString(R.string.share); Intent shareIntent = ActionUtil.getPumpkinShareIntent(news); Intent chooser = Intent.createChooser(shareIntent, label); chooser.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(chooser); }
Source:
<code>public static Slice ipPrefix(@SqlType(StandardTypes.IPADDRESS) Slice value, @SqlType(StandardTypes.BIGINT) long subnetSize) { byte[] ipV4Map = new byte[12]; ipV4Map[10] = (byte) 0xff; ipV4Map[11] = (byte) 0xff; if (Arrays.equals(value.getBytes(0, 12), ipV4Map)) { checkCondition(0 <= subnetSize && subnetSize <= 32, INVALID_FUNCTION_ARGUMENT, "IPv4 subnet size must be in range [0, 32]"); } else { checkCondition(0 <= subnetSize && subnetSize <= 128, INVALID_FUNCTION_ARGUMENT, "IPv6 subnet size must be in range [0, 128]"); } <START> String addressStr; <END> try { addressStr = InetAddresses.toAddrString(InetAddress.getByAddress(value.getBytes())); } catch (UnknownHostException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid IP address binary length: " + value.length(), e); } return castFromVarcharToIpPrefix(utf8Slice(addressStr + "/" + Long.toString(subnetSize))); }</code><technical_language>nit: address addressString, addrString consistent another file</technical_language>

Target:
public static Slice ipPrefix(@SqlType(StandardTypes.IPADDRESS) Slice value, @SqlType(StandardTypes.BIGINT) long subnetSize) { InetAddress address; try { address = InetAddress.getByAddress(value.getBytes()); } catch (UnknownHostException e) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid IP address binary: " + value.toStringUtf8(), e); } int addressLength = address.getAddress().length; if (addressLength == 4) { checkCondition(0 <= subnetSize && subnetSize <= 32, INVALID_FUNCTION_ARGUMENT, "IPv4 subnet size must be in range [0, 32]"); } else if (addressLength == 16) { checkCondition(0 <= subnetSize && subnetSize <= 128, INVALID_FUNCTION_ARGUMENT, "IPv6 subnet size must be in range [0, 128]"); } else { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid InetAddress length: " + addressLength); } return castFromVarcharToIpPrefix(utf8Slice(InetAddresses.toAddrString(address) + "/" + subnetSize)); }
Source:
<code>private void init() { try { URL url = new File(schemaPath).toURI().toURL(); String sdl = Resources.toString(url, Charsets.UTF_8); GraphQLSchema graphQLSchema = buildSchema(sdl); this.graphql = GraphQL.newGraphQL(graphQLSchema).build(); } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>a logger here</technical_language>

Target:
private void init() { try { URL url = new File(schemaPath).toURI().toURL(); String sdl = Resources.toString(url, Charsets.UTF_8); GraphQLSchema graphQLSchema = buildSchema(sdl); this.graphql = GraphQL.newGraphQL(graphQLSchema).build(); } catch (Exception e) { log.error("Unable to create the GraphQL api"); } }
Source:
<code><START> public T getClient(String uri, Map<String, String> httpConfig) { <END> T client = getOverride(uri); if (client == null) { client = createClient(getRestClient(uri, httpConfig)); } return client; }</code><technical_language>synchronized public methods (to this class thread safe)</technical_language>

Target:
public synchronized T getClient(String uri, Map<String, String> httpConfig) { T client = getOverride(uri); if (client == null) { client = createClient(getRestClient(uri, httpConfig)); } return client; }
Source:
<code>public void dropView(NewVisitView view) { <START> if (statePrimarySubscription!=null && !statePrimarySubscription.isUnsubscribed()) { <END> statePrimarySubscription.unsubscribe(); } super.dropView(view); clearSwitchListeners(); ButterKnife.unbind(this); }</code><technical_language>dropView is called rotation, want unsubscribe here</technical_language>

Target:
public void dropView(NewVisitView view) { super.dropView(view); clearSwitchListeners(); ButterKnife.unbind(this); }
Source:
<code>public void doWrite(Row value, int ordinal) { if (value.getField(ordinal) == null) { ((DateDayVector) getValueVector()).setNull(getCount()); } else { ((DateDayVector) getValueVector()).setSafe( <START> getCount(), SqlDateTimeUtils.dateToInternal(((Date) value.getField(ordinal)))); <END> } }</code><technical_language>DateWriter is for planner. blink planner class here, otherwise, Pyflink depend blink planner is configured planner</technical_language>

Target:
public void doWrite(Row value, int ordinal) { if (value.getField(ordinal) == null) { ((DateDayVector) getValueVector()).setNull(getCount()); } else { ((DateDayVector) getValueVector()).setSafe( getCount(), PythonTypeUtils.dateToInternal(((Date) value.getField(ordinal)))); } }
Source:
<code>public AbstractMailer(Props props) { this.azkabanName = props.getString("azkaban.name", "azkaban"); this.mailHost = props.getString("mail.host", "localhost"); this.mailUser = props.getString("mail.user", ""); this.mailPassword = props.getString("mail.password", ""); long maxAttachmentSizeInMB = <START> props.getInt("mail.max.attachment.size.mb", 1000); <END> attachmentMazSizeInByte = maxAttachmentSizeInMB * MB_IN_BYTES; this.mailSender = props.getString("mail.sender", ""); this.clientHostname = props.get("server.hostname"); this.clientPort = props.getInt("server.port"); this.usesSSL = props.getBoolean("server.useSSL"); if (usesSSL) { referenceURL = "https://" + clientHostname + (clientPort == 443 ? "/" : ":" + clientPort + "/"); } else { referenceURL = "http://" + clientHostname + (clientPort == 80 ? "/" : ":" + clientPort + "/"); } }</code><technical_language>default 10 (10 MB), thousand</technical_language>

Target:
public AbstractMailer(Props props) { this.azkabanName = props.getString("azkaban.name", "azkaban"); this.mailHost = props.getString("mail.host", "localhost"); this.mailUser = props.getString("mail.user", ""); this.mailPassword = props.getString("mail.password", ""); long maxAttachmentSizeInMB = props.getInt("mail.max.attachment.size.mb", 100); attachmentMazSizeInByte = maxAttachmentSizeInMB * MB_IN_BYTES; this.mailSender = props.getString("mail.sender", ""); this.usesAuth = props.getBoolean("mail.useAuth", true); this.clientHostname = props.get("server.hostname"); this.clientPort = props.getInt("server.port"); this.usesSSL = props.getBoolean("server.useSSL"); if (usesSSL) { referenceURL = "https://" + clientHostname + (clientPort == 443 ? "/" : ":" + clientPort + "/"); } else { referenceURL = "http://" + clientHostname + (clientPort == 80 ? "/" : ":" + clientPort + "/"); } }
Source:
<code>private void saveMetadataAsBean(DocStructInterface inStrukturelement) { this.docStruct = inStrukturelement; LinkedList<MetadatumImpl> lsMeta = new LinkedList<>(); LinkedList<MetaPerson> lsPers = new LinkedList<>(); List<? extends MetadataInterface> tempMetadata = this.metaHelper.getMetadataInclDefaultDisplay( inStrukturelement, Helper.getMetadataLanguageForCurrentUser(), false, this.process); if (tempMetadata != null) { <START> for (MetadataInterface metadataInterface : tempMetadata) { <END> MetadatumImpl meta = new MetadatumImpl(metadataInterface, 0, this.myPrefs, this.process); meta.getSelectedItem(); lsMeta.add(meta); } } tempMetadata = this.metaHelper.getMetadataInclDefaultDisplay(inStrukturelement, Helper.getMetadataLanguageForCurrentUser(), true, this.process); if (tempMetadata != null) { for (MetadataInterface metadataInterface : tempMetadata) { lsPers.add(new MetaPerson((PersonInterface) metadataInterface, 0, this.myPrefs, inStrukturelement)); } } this.myMetadaten = lsMeta; this.metaPersonList = lsPers; determinePagesStructure(this.docStruct); }</code><technical_language>Interface appended variable name</technical_language>

Target:
private void saveMetadataAsBean(DocStructInterface inStrukturelement) { this.docStruct = inStrukturelement; LinkedList<MetadatumImpl> lsMeta = new LinkedList<>(); LinkedList<MetaPerson> lsPers = new LinkedList<>(); List<? extends MetadataInterface> tempMetadata = this.metaHelper.getMetadataInclDefaultDisplay( inStrukturelement, Helper.getMetadataLanguageForCurrentUser(), false, this.process); if (tempMetadata != null) { for (MetadataInterface metadata : tempMetadata) { MetadatumImpl meta = new MetadatumImpl(metadata, 0, this.myPrefs, this.process); meta.getSelectedItem(); lsMeta.add(meta); } } tempMetadata = this.metaHelper.getMetadataInclDefaultDisplay(inStrukturelement, Helper.getMetadataLanguageForCurrentUser(), true, this.process); if (tempMetadata != null) { for (MetadataInterface metadata : tempMetadata) { lsPers.add(new MetaPerson((PersonInterface) metadata, 0, this.myPrefs, inStrukturelement)); } } this.myMetadaten = lsMeta; this.metaPersonList = lsPers; determinePagesStructure(this.docStruct); }
Source:
<code>public void cleanupGcs() throws Exception { if (gcs == null) { return; } Storage.Objects.List req = gcs.objects().list(GCS_TEST_BUCKET); Objects objects; do { objects = req.execute(); List<StorageObject> items = objects.getItems(); if (items != null) { for (StorageObject object : items) { if (object.getName().startsWith(GCS_PREFIX)) { try { gcs.objects().delete(GCS_TEST_BUCKET, object.getName()).execute(); } catch (IOException e) { <START> e.printStackTrace(); <END> } } } } req.setPageToken(objects.getNextPageToken()); } while (null != objects.getNextPageToken()); }</code><technical_language>[minor] a logger</technical_language>

Target:
public void cleanupGcs() throws Exception { if (gcs == null) { return; } Storage.Objects.List req = gcs.objects().list(GCS_TEST_BUCKET); Objects objects; do { objects = req.execute(); List<StorageObject> items = objects.getItems(); if (items != null) { for (StorageObject object : items) { if (object.getName().startsWith(GCS_PREFIX)) { try { gcs.objects().delete(GCS_TEST_BUCKET, object.getName()).execute(); } catch (IOException e) { logger.warn("Failed to delete test gcs bucket: {}", object.getName(), e); } } } } req.setPageToken(objects.getNextPageToken()); } while (null != objects.getNextPageToken()); }
Source:
<code>private static <T> T createExperimentallyWithFallback( MetricsManager metricsManager, Supplier<TargetFactory.InstanceAndVersion<T>> experimentalProxySupplier, Supplier<TargetFactory.InstanceAndVersion<T>> fallbackProxySupplier, Class<T> type, AuxiliaryRemotingParameters clientParameters) { TargetFactory.InstanceAndVersion<T> fallbackProxy = fallbackProxySupplier.get(); try { return VersionSelectingClients.createVersionSelectingClient( metricsManager, fallbackProxy, <START> experimentalProxySupplier.get(), <END> VersionSelectingConfig.fromRemotingConfigSupplier(clientParameters.remotingClientConfig()), type); } catch (Exception e) { log.warn("Error occurred in creating an experimental proxy. Possible causes include" + " not running with SSL, which is deprecated and expected to be removed in a future release." + " Creating a legacy client.", e); return fallbackProxy.instance(); } }</code><technical_language>ordering of arguments other (i.e. want experimentalProxySupplier.get() fallbackProxy)</technical_language>

Target:
private static <T> T createExperimentallyWithFallback( MetricsManager metricsManager, Supplier<TargetFactory.InstanceAndVersion<T>> experimentalProxySupplier, Supplier<TargetFactory.InstanceAndVersion<T>> fallbackProxySupplier, Class<T> type, AuxiliaryRemotingParameters clientParameters) { TargetFactory.InstanceAndVersion<T> fallbackProxy = fallbackProxySupplier.get(); try { return VersionSelectingClients.createVersionSelectingClient( metricsManager, experimentalProxySupplier.get(), fallbackProxy, VersionSelectingConfig.fromRemotingConfigSupplier(clientParameters.remotingClientConfig()), type); } catch (Exception e) { log.warn("Error occurred in creating an experimental proxy. Possible causes include" + " not running with SSL, which is deprecated and expected to be removed in a future release." + " Creating a legacy client.", e); return fallbackProxy.instance(); } }
Source:
<code>public void initializeUI(UIBuilder builder) throws Exception { sources = inputFactory.createInputMany("sources", 's', FileResource.class); sources.setRequired(true); sources.setDescription("The folder or file where the java sources will be formatted"); profile = inputFactory.createInput("profile",'p', XMLResource.class); <START> profile.setRequired(true); <END> profile.setDescription("The eclipse code format file"); builder.add(sources).add(profile); }</code><technical_language>I this required</technical_language>

Target:
public void initializeUI(UIBuilder builder) throws Exception { sources = inputFactory.createInputMany("sources", 's', FileResource.class); sources.setDescription("The folder or file where the java sources will be formatted"); profile = inputFactory.createInput("profile", 'p', XMLResource.class); profile.setDescription("The eclipse code format profile"); builder.add(sources).add(profile); }
Source:
<code>public void setValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) throws SQLException { Assert.notNull(this.serializer, "The serializer should not be null."); <START> Assert.notNull(this.lobHandler, "The lobhandler should not be null."); <END> String groupKey = getKey(groupId); long createdDate = System.currentTimeMillis(); String messageId = getKey(requestMessage.getHeaders().getId()); byte[] messageBytes = this.serializer.convert(requestMessage); if (logger.isDebugEnabled()) { logger.debug("Inserting message with id key=" + messageId); } preparedStatement.setString(1, messageId); preparedStatement.setString(2, groupKey); preparedStatement.setString(3, region); preparedStatement.setLong(4, createdDate); Integer priority = requestMessage.getHeaders().get(IntegrationMessageHeaderAccessor.PRIORITY, Integer.class); if (priorityEnabled && priority != null) { preparedStatement.setInt(5, priority); } else { preparedStatement.setNull(5, Types.NUMERIC); } this.lobHandler.getLobCreator().setBlobAsBytes(preparedStatement, 6, messageBytes); }</code><technical_language>I guess test matter. agreed null is OK design for inheritors care this extra steps</technical_language>

Target:
public void setValues(PreparedStatement preparedStatement, Message<?> requestMessage, Object groupId, String region, boolean priorityEnabled) throws SQLException { String groupKey = getKey(groupId); long createdDate = System.currentTimeMillis(); String messageId = getKey(requestMessage.getHeaders().getId()); byte[] messageBytes = null; if (this.serializer != null) { messageBytes = this.serializer.convert(requestMessage); } preparedStatement.setString(1, messageId); preparedStatement.setString(2, groupKey); preparedStatement.setString(3, region); preparedStatement.setLong(4, createdDate); Integer priority = requestMessage.getHeaders().get(IntegrationMessageHeaderAccessor.PRIORITY, Integer.class); if (priorityEnabled && priority != null) { preparedStatement.setInt(5, priority); } else { preparedStatement.setNull(5, Types.NUMERIC); } if (this.lobHandler != null) { this.lobHandler.getLobCreator().setBlobAsBytes(preparedStatement, 6, messageBytes); } }
Source:
<code>private void refreshLocks() { ImmutableList<LockRefreshToken> refreshCopy = ImmutableList.copyOf(toRefresh); if (refreshCopy.isEmpty()) { return; } Set<LockRefreshToken> refreshedTokens = new HashSet<>(); for (List<LockRefreshToken> tokenBatch : Lists.partition(refreshCopy, REFRESH_BATCH_SIZE)) { refreshedTokens.addAll(delegate.refreshLockRefreshTokens(tokenBatch)); } Set<LockRefreshToken> failedTokens = null; for (LockRefreshToken token : refreshCopy) { if (!refreshedTokens.contains(token) && toRefresh.contains(token)) { log.warn("failed to refresh lock: {}", token); toRefresh.remove(token); if (failedTokens == null) { failedTokens = new HashSet<>(); } failedTokens.add(token); } } if (failedTokens != null && !failedTokens.isEmpty()) { Set<LockRefreshToken> unmodifiableFailedTokens = Collections.unmodifiableSet(failedTokens); for (FailedRefreshCallback callback : failedRefreshCallbacks) { <START> exec.submit(() -> callback.onFailedRefresh(unmodifiableFailedTokens)); <END> } } }</code><technical_language>This execute, exceptions recorded. suggestion exec.execute(() -> callback.onFailedRefresh(unmodifiableFailedTokens)); unfortunate run baseline errorprone pre-merge, caught this: <LINK_0></technical_language>

Target:
private void refreshLocks() { ImmutableList<LockRefreshToken> refreshCopy = ImmutableList.copyOf(toRefresh); if (refreshCopy.isEmpty()) { return; } Set<LockRefreshToken> refreshedTokens = new HashSet<>(); for (List<LockRefreshToken> tokenBatch : Lists.partition(refreshCopy, REFRESH_BATCH_SIZE)) { refreshedTokens.addAll(delegate.refreshLockRefreshTokens(tokenBatch)); } Set<LockRefreshToken> failedTokens = null; for (LockRefreshToken token : refreshCopy) { if (!refreshedTokens.contains(token) && toRefresh.contains(token)) { log.warn("failed to refresh lock: {}", token); toRefresh.remove(token); if (failedTokens == null) { failedTokens = new HashSet<>(); } failedTokens.add(token); } } if (failedTokens != null && !failedTokens.isEmpty()) { Set<LockRefreshToken> unmodifiableFailedTokens = Collections.unmodifiableSet(failedTokens); for (FailedRefreshCallback callback : failedRefreshCallbacks) { callbackExec.execute(() -> callback.onFailedRefresh(unmodifiableFailedTokens)); } } }
Source:
<code>public void executeCommand(Command command, ExecutionHandlerContext context) { byte[] channelName = command.getProcessedCommand().get(1); long subscriptionCount = <START> context.getPubSub().unsubscribe(new String(channelName), context.getClient()); <END> ArrayList<Object> items = new ArrayList<>(); items.add("unsubscribe"); items.add(channelName); items.add(subscriptionCount); ByteBuf response = null; try { response = Coder.getArrayResponse(context.getByteBufAllocator(), items); } catch (CoderException e) { e.printStackTrace(); } command.setResponse(response); }</code><technical_language>in PublishExecutor SubscribeExecutor</technical_language>

Target:
public void executeCommand(Command command, ExecutionHandlerContext context) { byte[] channelName = command.getProcessedCommand().get(1); long subscriptionCount = context.getPubSub().unsubscribe(new String(channelName), context.getClient()); ArrayList<Object> items = new ArrayList<>(); items.add("unsubscribe"); items.add(channelName); items.add(subscriptionCount); ByteBuf response = null; try { response = Coder.getArrayResponse(context.getByteBufAllocator(), items); } catch (CoderException e) { logger.warn("Error encoding unsubscribe response", e); } command.setResponse(response); }
Source:
<code>private boolean hasModuleAttribute(IClasspathEntry entry) { <START> return false && hasEnabledBooleanAttribute(IClasspathAttribute.MODULE, entry); <END> }</code><technical_language>suggestion return hasEnabledBooleanAttribute(IClasspathAttribute.MODULE, entry);</technical_language>

Target:
private boolean hasModuleAttribute(IClasspathEntry entry) { return hasEnabledBooleanAttribute("module", entry); }
Source:
<code><START> public void createsInitialDesktopFile() throws Exception { <END> fileProvider.readAnswers.put(PATH_OWN_DESKTOP_FILE, new IOException("desktop file not existing")); registration.handleSchemes(Arrays.asList(ADT_SCHEME_INFO), Collections.emptyList()); assertEquals(PATH_OWN_DESKTOP_FILE, fileProvider.writePath); assertMimeTypeInFileIs("x-scheme-handler/adt;"); assertExecInFileIs("/home/myuser/Eclipse/Eclipse %u"); assertXdgMimeCalledFor("x-scheme-handler/adt"); }</code><technical_language>assertion for productname added</technical_language>

Target:
public void createsInitialDesktopFile() throws Exception { fileProvider.readAnswers.put(PATH_OWN_DESKTOP_FILE, new IOException("desktop file not existing")); registration.handleSchemes(Arrays.asList(ADT_SCHEME_INFO), Collections.emptyList()); assertEquals(PATH_OWN_DESKTOP_FILE, fileProvider.writePath); assertAppNameInFileIs("myProduct"); assertMimeTypeInFileIs("x-scheme-handler/adt;"); assertExecInFileIs("/home/myuser/Eclipse/Eclipse %u"); assertXdgMimeCalledFor("x-scheme-handler/adt"); }
Source:
<code>public Class<? extends ConnectorTableHandle> getTableHandleClass() { <START> return TestingMetadata.TestingTableHandle.class; <END> }</code><technical_language>static import</technical_language>

Target:
public Class<? extends ConnectorTableHandle> getTableHandleClass() { return TestingTableHandle.class; }
Source:
<code>public CollectionDescription update( HttpServletRequest request, HttpServletResponse response, CollectionDescription collectionDescription ) throws IOException, ZebedeeException { Session session = Root.zebedee.getSessionsService().get(request); <START> if (Root.zebedee.getPermissions().canEdit(session.getEmail()) == false) { <END> throw new UnauthorizedException("You are not authorised to update collections."); } com.github.onsdigital.zebedee.model.Collection collection = Collections.getCollection(request); com.github.onsdigital.zebedee.model.Collection updatedCollection = collection.update( collection, collectionDescription, Root.zebedee, Root.getScheduler(), session); Audit.Event.COLLECTION_UPDATED .parameters() .host(request) .fromTo(collection.path.toString(), updatedCollection.path.toString()) .actionedBy(session.getEmail()) .log(); return updatedCollection.description; }</code><technical_language>This changed if (!Root.zebedee.getPermissions().canEdit(session.getEmail()))</technical_language>

Target:
public CollectionDescription update( HttpServletRequest request, HttpServletResponse response, CollectionDescription collectionDescription ) throws IOException, ZebedeeException { Session session = Root.zebedee.getSessionsService().get(request); if (!Root.zebedee.getPermissions().canEdit(session.getEmail())) { throw new UnauthorizedException("You are not authorised to update collections."); } com.github.onsdigital.zebedee.model.Collection collection = Collections.getCollection(request); com.github.onsdigital.zebedee.model.Collection updatedCollection = collection.update( collection, collectionDescription, Root.zebedee, Root.getScheduler(), session); Audit.Event.COLLECTION_UPDATED .parameters() .host(request) .fromTo(collection.path.toString(), updatedCollection.path.toString()) .actionedBy(session.getEmail()) .log(); return updatedCollection.description; }
Source:
<code>public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_API_KEY"))) .endpoint(Configuration.getGlobalConfiguration().get("AZURE_TEXT_ANALYTICS_ENDPOINT")) .buildAsyncClient(); String document = "Microsoft employee with ssn 859-98-0987 is using our awesome API's."; client.recognizePiiEntities(document).subscribe( entityCollection -> entityCollection.forEach(entity -> System.out.printf( <START> "Recognized personal identifiable information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", <END> entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())), error -> System.err.println("There was an error recognizing PII entities of the text." + error), () -> System.out.println("Entities recognized.") ); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }</code><technical_language>Some places "Recognized Personally Identifiable Information entity" I prefer this too, pick, consistency in samples</technical_language>

Target:
public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildAsyncClient(); String document = "My SSN is 859-98-0987"; client.recognizePiiEntities(document).subscribe( entityCollection -> entityCollection.forEach(entity -> System.out.printf( "Recognized Personal Identifiable Information entity: %s, entity category: %s, entity sub-category: %s, score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())), error -> System.err.println("There was an error recognizing PII entities of the text." + error), () -> System.out.println("Entities recognized.") ); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }
Source:
<code>T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (codec == null) { return null; } Object d = data; if (d instanceof byte[]) { this.codec = codec; if (provider == null) { <START> d = codec.decode((byte[]) data); <END> } else { T tmp = provider.get(); codec.mergeFrom((byte[]) data, tmp); d = tmp; } } data = d; return (T) data; }</code><technical_language>Nope, data instance member</technical_language>

Target:
T toObject(ProtobufCodec<T> codec, Provider<T> provider) { if (codec == null) { return null; } Object d = data; if (d instanceof byte[]) { this.codec = codec; if (provider == null) { d = codec.decode((byte[]) d); } else { T tmp = provider.get(); codec.mergeFrom((byte[]) d, tmp); d = tmp; } data = d; } return (T) d; }
Source:
<code>public void postOnCreateSnapshot(VdcReturnValueBase returnValue, GlusterVolumeSnapshotEntity snapshot, GlusterVolumeSnapshotModel snapshotModel) { <START> getWindow(); <END> if (returnValue != null && returnValue.getSucceeded()) { setWindow(null); } }</code><technical_language>please remove this</technical_language>

Target:
public void postOnCreateSnapshot(VdcReturnValueBase returnValue, GlusterVolumeSnapshotEntity snapshot, GlusterVolumeSnapshotModel snapshotModel) { if (returnValue != null && returnValue.getSucceeded()) { setWindow(null); } }
Source:
<code>private void validateTestExecution(TestExecutionEntity testExecution) { if (StringUtils.isEmpty(testExecution.getEnvId())) { throw new InvalidTestExecutionException( "envId must be specified"); } if (testExecution.getLoadScenarioId() == null && testExecution.getTestProjectURL() == null) { throw new InvalidTestExecutionException( <START> "Neither a test project URL nor a load scenario name are not specified"); <END> } if (StringUtils.isNotBlank(testExecution.getTestProjectURL())) { try { new URL(testExecution.getTestProjectURL()); } catch (MalformedURLException e) { throw new InvalidTestExecutionException( format("Test project URL '%s' is not valid URL! %s", testExecution.getTestProjectURL(), e.getMessage()), e); } } }</code><technical_language>=></technical_language>

Target:
private void validateTestExecution(TestExecutionEntity testExecution) { if (StringUtils.isEmpty(testExecution.getEnvId())) { throw new InvalidTestExecutionException( "envId must be specified"); } if (testExecution.getLoadScenarioId() == null && testExecution.getTestProjectURL() == null) { throw new InvalidTestExecutionException( "Neither a test project URL nor a load scenario name are specified"); } if (StringUtils.isNotBlank(testExecution.getTestProjectURL())) { try { new URL(testExecution.getTestProjectURL()); } catch (MalformedURLException e) { throw new InvalidTestExecutionException( format("Test project URL '%s' is not valid URL! %s", testExecution.getTestProjectURL(), e.getMessage()), e); } } }
Source:
<code>public void uploadFromFile3() throws IOException { BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); Map<String, String> tags = Collections.singletonMap("tag", "value"); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); <START> Integer blockSize = 100 * 1024 * 1024; END> ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions(blockSize, null, null); try { client.uploadFromFile(filePath, parallelTransferOptions, headers, metadata, tags, AccessTier.HOT, requestConditions, timeout); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); } END: com.azure.storage.blob.BlobClient.uploadFromFile#String-ParallelTransferOptions-BlobHttpHeaders-Map-Map-AccessTier-BlobRequestConditions-Duration }</code><technical_language>Please long block size deprecated constructor below</technical_language>

Target:
public void uploadFromFile3() throws IOException { BlobHttpHeaders headers = new BlobHttpHeaders() .setContentMd5("data".getBytes(StandardCharsets.UTF_8)) .setContentLanguage("en-US") .setContentType("binary"); Map<String, String> metadata = Collections.singletonMap("metadata", "value"); Map<String, String> tags = Collections.singletonMap("tag", "value"); BlobRequestConditions requestConditions = new BlobRequestConditions() .setLeaseId(leaseId) .setIfUnmodifiedSince(OffsetDateTime.now().minusDays(3)); Long blockSize = 100 * 1024 * 1024L; ParallelTransferOptions parallelTransferOptions = new ParallelTransferOptions().setBlockSizeLong(blockSize); try { client.uploadFromFile(filePath, new BlobUploadFromFileOptions() .setParallelTransferOptions(parallelTransferOptions).setHeaders(headers).setMetadata(metadata) .setTags(tags).setTier(AccessTier.HOT).setRequestConditions(requestConditions), timeout); System.out.println("Upload from file succeeded"); } catch (UncheckedIOException ex) { System.err.printf("Failed to upload from file %s%n", ex.getMessage()); } END: com.azure.storage.blob.BlobClient.uploadFromFile#String-BlobUploadFromFileOptions-Duration }
Source:
<code>public static AuthUI getInstance(@NonNull FirebaseApp app) { if (ProviderAvailability.IS_TWITTER_AVAILABLE) { <START> Log.w(TAG, "You no longer need TwitterKit to sign in with Twitter."); <END> } AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { authUi = new AuthUI(app); INSTANCES.put(app, authUi); } } return authUi; }</code><technical_language>flesh this out. "Beginning FirebaseUI 6.2.0 longer need include TwitterKit SDK sign in Twitter. https://{whatever release page link} is for more information"</technical_language>

Target:
public static AuthUI getInstance(@NonNull FirebaseApp app) { if (ProviderAvailability.IS_TWITTER_AVAILABLE) { String releaseUrl = "<LINK_0>"; Log.w(TAG, String.format("Beginning with FirebaseUI 6.2.0 you no longer need to " + "include the TwitterKit SDK to sign in with Twitter. " + "Go to %s for more information", releaseUrl)); } AuthUI authUi; synchronized (INSTANCES) { authUi = INSTANCES.get(app); if (authUi == null) { authUi = new AuthUI(app); INSTANCES.put(app, authUi); } } return authUi; }
Source:
<code>public ExternalImage(String id, Serializable src) { <START> this(id, src, (List<Serializable>)null); <END> }</code><technical_language>If I wrong, considered a practice supply empty list instead of a null list. I guess Collections.emptyList() here</technical_language>

Target:
public ExternalImage(String id, Serializable src) { this(id, Model.of(src), Model.ofList(Collections.<Serializable> emptyList())); }