auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static X509KeyManager createKeyManager( String keyStoreLocation, String keyStorePassword, String keyStoreTypeProp) throws KeyManagerException { FileInputStream inputStream = null; if (keyStorePassword == null) { keyStorePassword = ""; <START> } <END> try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( keyStoreTypeProp, keyStoreLocation); KeyStore ks = FileKeyStoreLoader .getBuilderForKeyStoreFileType(storeFileType) .setKeyStorePath(keyStoreLocation) .setKeyStorePassword(keyStorePassword) .build() .loadKeyStore(); KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); kmf.init(ks, keyStorePassword.toCharArray()); for (KeyManager km : kmf.getKeyManagers()) { if (km instanceof X509KeyManager) { return (X509KeyManager) km; } } throw new KeyManagerException("Couldn't find X509KeyManager"); } catch (IOException | GeneralSecurityException keyManagerCreationException) { throw new KeyManagerException(keyManagerCreationException); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException ioException) { LOG.info("Failed to close key store input stream", ioException); } } } }</code><technical_language>IllegalArgumentException is here. I is handled</technical_language>

Target:
public static X509KeyManager createKeyManager( String keyStoreLocation, String keyStorePassword, String keyStoreTypeProp) throws KeyManagerException { if (keyStorePassword == null) { keyStorePassword = ""; } try { KeyStoreFileType storeFileType = KeyStoreFileType.fromPropertyValueOrFileName( keyStoreTypeProp, keyStoreLocation); KeyStore ks = FileKeyStoreLoaderBuilderProvider .getBuilderForKeyStoreFileType(storeFileType) .setKeyStorePath(keyStoreLocation) .setKeyStorePassword(keyStorePassword) .build() .loadKeyStore(); KeyManagerFactory kmf = KeyManagerFactory.getInstance("PKIX"); kmf.init(ks, keyStorePassword.toCharArray()); for (KeyManager km : kmf.getKeyManagers()) { if (km instanceof X509KeyManager) { return (X509KeyManager) km; } } throw new KeyManagerException("Couldn't find X509KeyManager"); } catch (IOException | GeneralSecurityException | IllegalArgumentException e) { throw new KeyManagerException(e); } }
Source:
<code>public void start(Context c) { mContext = c; LocationManager lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); } if (mLastLocation != null) { <START> lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mNetworkLocationListener); <END> } }</code><technical_language>is this null checking requesting locations? I ok request new locations if a location in GPS provider</technical_language>

Target:
public void start(Context c) { mContext = c; LocationManager lm = (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); if (mLastLocation == null) { mLastLocation = lm.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); } } lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, mNetworkLocationListener); }
Source:
<code>public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); for (String file : status.getUntracked()) { if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } <START> if (directories) { <END> for (String dir : status.getUntrackedFolders()) { if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }</code><technical_language>Curlies needed</technical_language>

Target:
public Set<String> call() { Set<String> files = new TreeSet<String>(); try { StatusCommand command = new StatusCommand(repo); Status status = command.call(); Set<String> filtered = filterUntrackedFolders( status.getUntracked(), status.getUntrackedFolders()); for (String file : filtered) { if (paths.isEmpty() || paths.contains(file)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), file)); files.add(file); } } if (directories) for (String dir : status.getUntrackedFolders()) if (paths.isEmpty() || paths.contains(dir)) { if (!dryRun) FileUtils.delete(new File(repo.getWorkTree(), dir), FileUtils.RECURSIVE); files.add(dir + "/"); } } catch (IOException e) { throw new JGitInternalException(e.getMessage(), e); } return files; }
Source:
<code>public ShardNodes(UUID shardUuid, Optional<UUID> deltaShardUuid, Set<String> nodeIdentifiers) { this.shardUuid = requireNonNull(shardUuid, "shardUuid is null"); <START> this.deltaShardUuid = requireNonNull(deltaShardUuid, "shardUuid is null"); <END> this.nodeIdentifiers = ImmutableSet.copyOf(requireNonNull(nodeIdentifiers, "nodeIdentifiers is null")); }</code><technical_language>typo</technical_language>

Target:
public ShardNodes(UUID shardUuid, Optional<UUID> deltaShardUuid, Set<String> nodeIdentifiers) { this.shardUuid = requireNonNull(shardUuid, "shardUuid is null"); this.deltaShardUuid = requireNonNull(deltaShardUuid, "deltaShardUuid is null"); this.nodeIdentifiers = ImmutableSet.copyOf(requireNonNull(nodeIdentifiers, "nodeIdentifiers is null")); }
Source:
<code>private void setConflictsWith(GerritClient gerritClient, ChangeInfo element) { ChangeInfo[] conflictsWithChangeInfo = null; if (!("MERGED".equals(element.getStatus())) && !("ABANDONED".equals(element.getStatus()))) { try { conflictsWithChangeInfo = queryConflictsWith(gerritClient, element.getChange_id(), new NullProgressMonitor()); } catch (MalformedURLException e) { EGerritCorePlugin.logError(gerritClient.getRepository().formatGerritVersion() + e.getMessage()); } List<ChangeInfo> conflictsWithChangeInfolist = null; List<ChangeInfo> conflictsWithChangeInfolistNew = new ArrayList<ChangeInfo>(); if (conflictsWithChangeInfo != null) { conflictsWithChangeInfolist = Arrays.asList(conflictsWithChangeInfo); for (int i = 0; i < conflictsWithChangeInfolist.size(); i++) { <START> if (conflictsWithChangeInfolist.get(i).getChange_id().compareTo(fChangeInfo.getChange_id()) != 0 <END> && conflictsWithChangeInfolist.get(i).getStatus().compareTo("NEW") == 0 && conflictsWithChangeInfolist.get(i).isMergeable()) { conflictsWithChangeInfolistNew.add(conflictsWithChangeInfolist.remove(i)); } } } fChangeInfo.getConflictsWith().clear(); fChangeInfo.getConflictsWith().addAll(conflictsWithChangeInfolistNew); } }</code><technical_language>This logic replaced proper queryConflict. This require extending QueryChangesCommand</technical_language>

Target:
private void setConflictsWith(GerritClient gerritClient, ChangeInfo element) { ChangeInfo[] conflictsWithChangeInfo = null; if (!("MERGED".equals(element.getStatus())) && !("ABANDONED".equals(element.getStatus()))) { try { conflictsWithChangeInfo = queryConflictsWith(gerritClient, element.getChange_id(), new NullProgressMonitor()); } catch (MalformedURLException e) { EGerritCorePlugin.logError(gerritClient.getRepository().formatGerritVersion() + e.getMessage()); } List<ChangeInfo> conflictsWithChangeInfolist = null; List<ChangeInfo> conflictsWithChangeInfolistNew = new ArrayList<ChangeInfo>(); if (conflictsWithChangeInfo != null) { conflictsWithChangeInfolist = Arrays.asList(conflictsWithChangeInfo); for (int i = 0; i < conflictsWithChangeInfolist.size(); i++) { if (conflictsWithChangeInfolist.get(i).getChange_id().compareTo(fChangeInfo.getChange_id()) != 0) { conflictsWithChangeInfolistNew.add(conflictsWithChangeInfolist.remove(i)); } } } fChangeInfo.getConflictsWith().clear(); fChangeInfo.getConflictsWith().addAll(conflictsWithChangeInfolistNew); } }
Source:
<code>public void setUp() throws Exception { config = new OzoneConfiguration(); config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY, StringUtils.join(OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT, <START> ":", String.valueOf(scmRpcSecurePort))); <END> securityProtocolServer = new SCMSecurityProtocolServer(config, null); }</code><technical_language>OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT:0 Is reason for this way</technical_language>

Target:
public void setUp() throws Exception { config = new OzoneConfiguration(); config.set(OZONE_SCM_SECURITY_SERVICE_ADDRESS_KEY, OZONE_SCM_SECURITY_SERVICE_BIND_HOST_DEFAULT + ":0"); securityProtocolServer = new SCMSecurityProtocolServer(config, null); }
Source:
<code>protected boolean basicHandlePrimaryDestroy(final EventID eventId, boolean addToUnprocessedTokens) { if (this.sender.isPrimary()) { return false; } GatewaySenderStats statistics = this.sender.getStatistics(); synchronized (unprocessedEventsLock) { if (this.sender.isPrimary()) { return false; } if (this.unprocessedEvents == null) return false; EventWrapper ew = this.unprocessedEvents.remove(eventId); if (ew != null) { ew.event.release(); statistics.incUnprocessedEventsRemovedByPrimary(); return true; } else if (addToUnprocessedTokens) { <START> Long mapValue = Long.valueOf(System.currentTimeMillis() + AbstractGatewaySender.TOKEN_TIMEOUT); <END> Long oldv = this.unprocessedTokens.put(eventId, mapValue); if (oldv == null) { statistics.incUnprocessedTokensAddedByPrimary(); } else { } } } return false; }</code><technical_language>This Long mapValue = System.currentTimeMillis() + AbstractGatewaySender.TOKEN_TIMEOUT;</technical_language>

Target:
protected boolean basicHandlePrimaryDestroy(final EventID eventId, boolean addToUnprocessedTokens) { if (this.sender.isPrimary()) { return false; } GatewaySenderStats statistics = this.sender.getStatistics(); synchronized (unprocessedEventsLock) { if (this.sender.isPrimary()) { return false; } if (this.unprocessedEvents == null) return false; EventWrapper ew = this.unprocessedEvents.remove(eventId); if (ew != null) { ew.event.release(); statistics.incUnprocessedEventsRemovedByPrimary(); return true; } else if (addToUnprocessedTokens) { if (logger.isTraceEnabled()) { logger.trace("{}: fromPrimary destroy event : added to unprocessed token map", sender.getId(), eventId); } Long mapValue = System.currentTimeMillis() + AbstractGatewaySender.TOKEN_TIMEOUT; Long oldv = this.unprocessedTokens.put(eventId, mapValue); if (oldv == null) { statistics.incUnprocessedTokensAddedByPrimary(); } } } return false; }
Source:
<code>protected Collection<Declarable> processAmqpListener(RabbitListener rabbitListener, Method method, Object bean, String beanName) { final Collection<Declarable> declarables = super.processAmqpListener(rabbitListener, method, bean, beanName); final RabbitAdmin rabbitAdmin = resolveRabbitAdminBean(rabbitListener); <START> declarables.stream() <END> .filter(dec -> dec.getDeclaringAdmins().isEmpty()) .filter(dec -> dec instanceof AbstractDeclarable) .map(dec -> (AbstractDeclarable) dec) .forEach(dec -> dec.setAdminsThatShouldDeclare(rabbitAdmin)); return declarables; }</code><technical_language>I prefer regular loop ifs instead of Stream objects</technical_language>

Target:
protected Collection<Declarable> processAmqpListener(RabbitListener rabbitListener, Method method, Object bean, String beanName) { final Collection<Declarable> declarables = super.processAmqpListener(rabbitListener, method, bean, beanName); final String rabbitAdmin = resolveMultiRabbitAdminName(rabbitListener); for (final Declarable declarable : declarables) { if (declarable.getDeclaringAdmins().isEmpty()) { declarable.setAdminsThatShouldDeclare(rabbitAdmin); } } return declarables; }
Source:
<code><START> public void testListImagesReturns404() throws InterruptedException { <END> server.enqueue(response404()); Iterable<Image> images = api.imageApi().list(Regions.EU_CENTRAL_1.getName()).concat(); assertTrue(isEmpty(images)); assertEquals(server.getRequestCount(), 1); }</code><technical_language>verify sending page size parameter</technical_language>

Target:
public void testListImagesReturns404() { server.enqueue(response404()); Iterable<Image> images = api.imageApi().list(Regions.EU_CENTRAL_1.getName()).concat(); assertTrue(isEmpty(images)); assertEquals(server.getRequestCount(), 1); }
Source:
<code>public boolean isAPIArtifactExists(String APIId, String gatewayLabel) throws APIManagementException { int count = 0; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); <START> PreparedStatement statement = connection.prepareStatement(SQLConstants.CHECK_ARTIFACT_EXISTS)) { <END> statement.setString(1, APIId); statement.setString(2, gatewayLabel); ResultSet rs = statement.executeQuery(); while (rs.next()) { count = rs.getInt("COUNT"); } } catch (SQLException e) { handleException("Failed to check API artifact status of API with ID " + APIId + " for label " + gatewayLabel, e); } return count != 0; }</code><technical_language>query Select 1 check if rs.next</technical_language>

Target:
public boolean isAPIArtifactExists(String APIId, String gatewayLabel) throws APIManagementException { ResultSet rs = null; try (Connection connection = GatewayArtifactsMgtDBUtil.getArtifactSynchronizerConnection(); PreparedStatement statement = connection.prepareStatement(SQLConstants.CHECK_ARTIFACT_EXISTS)) { connection.setAutoCommit(false); connection.commit(); statement.setString(1, APIId); statement.setString(2, gatewayLabel); rs = statement.executeQuery(); return rs.next(); } catch (SQLException e) { handleException("Failed to check API artifact status of API with ID " + APIId + " for label " + gatewayLabel, e); } finally { GatewayArtifactsMgtDBUtil.closeResultSet(rs); } return false; }
Source:
<code>public PaletteItemDropCommand(IPaletteItem paletteItem, boolean doNotShowWizard){ super(); this.paletteItem = paletteItem; this.doNotShowWizard = doNotShowWizard; <START> wizard = paletteItem.createWizard(); <END> corrector = paletteItem.createPositionCorrector(); }</code><technical_language>Wizard instance is created early. cached, created requesting paletteItem in createDropWizard(). Implementation of getCustomWizardName() is needed - is check if wizard is available. IPaletteItem needs method hasWizard(). implementations called getCustomWizardName() create wizard. Here, wizard is created IPaletteItem answer if created creating it</technical_language>

Target:
public PaletteItemDropCommand(IPaletteItem paletteItem, boolean doNotShowWizard){ super(); this.paletteItem = paletteItem; this.doNotShowWizard = doNotShowWizard; corrector = paletteItem.createPositionCorrector(); }
Source:
<code>private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { long time = timeGraphControl.getTimeAtX(pt.x); List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; <START> if (duration == 0) { <END> int height = Math.max(timeGraphControl.getItemHeight(), 10) / 2; startTime = timeGraphControl.getTimeAtX(pt.x - height); endTime = timeGraphControl.getTimeAtX(pt.x + height); } if ((startTime <= time) && (endTime >= time)) { retVal.add(marker); } } } return retVal; }</code><technical_language>a non-zero duration is hard pinpoint mouse zoomed out. find x-coordinate of marker (start end) a threshold of a pixels left right</technical_language>

Target:
private static Iterable<IMarkerEvent> getMarkers(TimeGraphControl timeGraphControl, ITimeGraphEntry entry, Point pt) { List<IMarkerEvent> markers = timeGraphControl.getMarkers(); List<IMarkerEvent> retVal = new ArrayList<>(); if (markers != null) { int height = Math.max(timeGraphControl.getItemHeight(), 10) / 2; long fuzzStart = timeGraphControl.getTimeAtX(pt.x - height); long fuzzEnd = timeGraphControl.getTimeAtX(pt.x + height); for (IMarkerEvent marker : markers) { if (Objects.equals(marker.getEntry(), entry)) { long duration = marker.getDuration(); long startTime = marker.getTime(); long endTime = startTime + duration; if ((startTime < fuzzEnd) && (endTime > fuzzStart)) { retVal.add(marker); } } } } return retVal; }
Source:
<code>protected boolean handlePreloadPackage(String packagePath, String libsPath) { <START> Log.d(TAG, "Preload package ********************************************************"); Log.d(TAG, "WebView package = " + packagePath); <END> return false; }</code><technical_language>Dianne remove this. This is logspam</technical_language>

Target:
protected boolean handlePreloadPackage(String packagePath, String libsPath) { return false; }
Source:
<code>public void tearDown() throws Exception { <START> loggerContext.stop(); <END> }</code><technical_language>I call factory.stop expose LoggerContext a field. factory close context</technical_language>

Target:
public void tearDown() throws Exception { factory.stop(); }
Source:
<code>public void shouldGetMaterialByFolder() { Materials materials = new Materials(); HgMaterial material1 = MaterialsMother.hgMaterial(); material1.setFolder("folder1"); HgMaterial material2 = MaterialsMother.hgMaterial(); material2.setFolder("folder2"); materials.add(material1); materials.add(material2); <START> assertThat((HgMaterial) materials.byFolder("folder1"), Is.is(material1)); <END> }</code><technical_language>change some setting in IntelliJ disable static imports? do this? I done a lot. :)</technical_language>

Target:
public void shouldGetMaterialByFolder() { Materials materials = new Materials(); HgMaterial material1 = MaterialsMother.hgMaterial(); material1.setFolder("folder1"); HgMaterial material2 = MaterialsMother.hgMaterial(); material2.setFolder("folder2"); materials.add(material1); materials.add(material2); assertThat((HgMaterial) materials.byFolder("folder1"), is(material1)); }
Source:
<code>private void remove(final List<Field> newFields, final Field field) { <START> final Iterator<Field> fieldsIterator = newFields.iterator(); <END> while (fieldsIterator.hasNext()) { final Field next = fieldsIterator.next(); if (next.id() != null && next.id().equals(field.id())) { fieldsIterator.remove(); break; } } }</code><technical_language>I if change newFields.removeIf(next -> next.id() != null && next.id().equals(field.id()));</technical_language>

Target:
private void remove(final List<Field> newFields, final Field field) { newFields.removeIf(next -> next.id() != null && next.id().equals(field.id())); }
Source:
<code>public DenseLocalDateDoubleTimeSeries subSeries(LocalDate startInclusive, LocalDate endExclusive) { ArgChecker.notNull(startInclusive, "startInclusive"); ArgChecker.notNull(endExclusive, "endExclusive"); if (endExclusive.isBefore(startInclusive)) { throw new IllegalArgumentException( "Invalid sub series, end before start: " + startInclusive + " to " + endExclusive); } if (isEmpty() || startInclusive.equals(endExclusive) || !startDate.isBefore(endExclusive) || startInclusive.isAfter(getLatestDate())) { return EMPTY_SERIES; } int startIndex = dateCalculation.calculatePosition(startDate, startInclusive); int endIndex = dateCalculation.calculatePosition(startDate, endExclusive); return new DenseLocalDateDoubleTimeSeries( <START> startInclusive, <END> Arrays.copyOfRange(points, startIndex, endIndex), dateCalculation); }</code><technical_language>I suspect this break weekends, indices weekend adjusted, this date isn't</technical_language>

Target:
public LocalDateDoubleTimeSeries subSeries(LocalDate startInclusive, LocalDate endExclusive) { ArgChecker.notNull(startInclusive, "startInclusive"); ArgChecker.notNull(endExclusive, "endExclusive"); if (endExclusive.isBefore(startInclusive)) { throw new IllegalArgumentException( "Invalid sub series, end before start: " + startInclusive + " to " + endExclusive); } if (isEmpty() || startInclusive.equals(endExclusive) || !startDate.isBefore(endExclusive) || startInclusive.isAfter(getLatestDate())) { return LocalDateDoubleTimeSeries.empty(); } LocalDate resolvedStart = dateCalculation.adjustDate(Ordering.natural().max(startInclusive, startDate)); int startIndex = dateCalculation.calculatePosition(startDate, resolvedStart); int endIndex = dateCalculation.calculatePosition(startDate, endExclusive); return new DenseLocalDateDoubleTimeSeries( resolvedStart, Arrays.copyOfRange(points, Math.max(0, startIndex), Math.min(points.length, endIndex)), dateCalculation, true); }
Source:
<code>public static RntbdRequest decode(final ByteBuf in) { final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); if (resourceOperationCode == 0) { final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); throw new IllegalStateException(reason); } <START> final int start = in.writerIndex(); <END> final int expectedLength = in.readIntLE(); final RntbdRequestFrame header = RntbdRequestFrame.decode(in); final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } final byte[] payload = new byte[payloadBuf.readableBytes()]; payloadBuf.readBytes(payload); in.discardReadBytes(); return new RntbdRequest(header, metadata, payload); }</code><technical_language>why? is this related this PR? unrelated bug</technical_language>

Target:
public static RntbdRequest decode(final ByteBuf in) { final int resourceOperationCode = in.getInt(in.readerIndex() + Integer.BYTES); if (resourceOperationCode == 0) { final String reason = String.format("resourceOperationCode=0x%08X", resourceOperationCode); throw new IllegalStateException(reason); } final int start = in.readerIndex(); final int expectedLength = in.readIntLE(); final RntbdRequestFrame header = RntbdRequestFrame.decode(in); final RntbdRequestHeaders metadata = RntbdRequestHeaders.decode(in); final ByteBuf payloadBuf = in.readSlice(expectedLength - (in.readerIndex() - start)); final int observedLength = in.readerIndex() - start; if (observedLength != expectedLength) { final String reason = Strings.lenientFormat("expectedLength=%s, observedLength=%s", expectedLength, observedLength); throw new IllegalStateException(reason); } final byte[] payload = new byte[payloadBuf.readableBytes()]; payloadBuf.readBytes(payload); in.discardReadBytes(); return new RntbdRequest(header, metadata, payload); }
Source:
<code>public LookupsState getAllLookupsState() { <START> assertStarted(); <END> startStopLock.readLock().lock(); try { Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>(); Set<String> lookupsToDrop = new HashSet<>(); Iterator<Notice> iter = queue.iterator(); while (iter.hasNext()) { Notice notice = iter.next(); if (notice instanceof LoadNotice) { LoadNotice loadNotice = (LoadNotice) notice; lookupsToLoad.put(loadNotice.lookupName, loadNotice.lookupExtractorFactoryContainer); lookupsToDrop.remove(loadNotice.lookupName); } else if (notice instanceof DropNotice) { DropNotice dropNotice = (DropNotice) notice; lookupsToDrop.add(dropNotice.lookupName); lookupsToLoad.remove(dropNotice.lookupName); } else { throw new ISE("Unknown Notice type [%s].", notice.getClass().getName()); } } return new LookupsState(Maps.newHashMap(lookupMap), lookupsToLoad, lookupsToDrop); } finally { startStopLock.readLock().unlock(); } }</code><technical_language>if a problem needs checked in try block well</technical_language>

Target:
public LookupsState<LookupExtractorFactoryContainer> getAllLookupsState() { Preconditions.checkState(lifecycleLock.awaitStarted(1, TimeUnit.MILLISECONDS)); LookupUpdateState lookupUpdateState = stateRef.get(); Map<String, LookupExtractorFactoryContainer> lookupsToLoad = new HashMap<>(); Set<String> lookupsToDrop = new HashSet<>(); updateToLoadAndDrop(lookupUpdateState.noticesBeingHandled, lookupsToLoad, lookupsToDrop); updateToLoadAndDrop(lookupUpdateState.pendingNotices, lookupsToLoad, lookupsToDrop); return new LookupsState<>(lookupUpdateState.lookupMap, lookupsToLoad, lookupsToDrop); }
Source:
<code>public String extractChildNode(String fullChildPath, String prefixPath) { <START> return fullChildPath.substring(prefixPath.length() + URL_SEPARATOR.length()); <END> }</code><technical_language>is StringUtils.removeStart for</technical_language>

Target:
public String extractChildNode(String fullChildPath, String prefixPath) { return StringUtils.removeStart(fullChildPath, prefixPath + URL_SEPARATOR); }
Source:
<code>private ZapXmlConfiguration getRemoteConfigurationUrl(String url) throws IOException, ConfigurationException, InvalidCfuUrlException { HttpMessage msg = new HttpMessage(new URI(url, true), Model.getSingleton().getOptionsParam().getConnectionParam()); getHttpSender().sendAndReceive(msg,true); if (msg.getResponseHeader().getStatusCode() != HttpStatusCode.OK) { throw new IOException( "Expected '200 OK' but got '" + msg.getResponseHeader().getStatusCode() + " " + msg.getResponseHeader().getReasonPhrase() + "'"); } if (! msg.getRequestHeader().isSecure()) { throw new InvalidCfuUrlException(msg.getRequestHeader().getURI().toString()); } ZapXmlConfiguration config = new ZapXmlConfiguration(); config.setDelimiterParsingDisabled(true); config.load(new StringReader(msg.getResponseBody().toString())); File f = new File(Constant.FOLDER_LOCAL_PLUGIN, VERSION_FILE_NAME); <START> try (Writer out = new OutputStreamWriter(new FileOutputStream(f), StandardCharsets.UTF_8)){ <END> out.write(msg.getResponseBody().toString()); } catch (Exception e) { logger.error(e.getMessage(), e); } return config; }</code><technical_language>tab in Writer out a space</technical_language>

Target:
private ZapXmlConfiguration getRemoteConfigurationUrl(String url) throws IOException, ConfigurationException, InvalidCfuUrlException { HttpMessage msg = new HttpMessage(new URI(url, true), Model.getSingleton().getOptionsParam().getConnectionParam()); getHttpSender().sendAndReceive(msg,true); if (msg.getResponseHeader().getStatusCode() != HttpStatusCode.OK) { throw new IOException( "Expected '200 OK' but got '" + msg.getResponseHeader().getStatusCode() + " " + msg.getResponseHeader().getReasonPhrase() + "'"); } if (! msg.getRequestHeader().isSecure()) { throw new InvalidCfuUrlException(msg.getRequestHeader().getURI().toString()); } ZapXmlConfiguration config = new ZapXmlConfiguration(); config.setDelimiterParsingDisabled(true); config.load(new StringReader(msg.getResponseBody().toString())); File f = new File(Constant.FOLDER_LOCAL_PLUGIN, VERSION_FILE_NAME); try{ Files.write(f.toPath(), msg.getResponseBody().getBytes()); }catch(IOException ioe){ logger.error(ioe.getMessage(), ioe); } return config; }
Source:
<code>protected List<Integer> getSlotsEligibleForRollup(long now, long maxAgeMillis, long delayedMetricsMaxAgeMillis) { List<Integer> outputKeys = new ArrayList<Integer>(); long nowMillis = new DateTime().getMillis(); for (Map.Entry<Integer, UpdateStamp> entry : slotToUpdateStampMap.entrySet()) { final UpdateStamp update = entry.getValue(); final long timeElapsed = now - update.getTimestamp(); timeSinceUpdate.update(timeElapsed); if (update.getState() == UpdateStamp.State.Rolled) { continue; } if (timeElapsed <= maxAgeMillis) { continue; } if (update.getLastRollupTimestamp() > 0) { final long timeElapsedSinceLastRollup = now - update.getLastRollupTimestamp(); if (timeElapsedSinceLastRollup < DELAYED_METRICS_MAX_ALLOWED_DELAY) { if (timeElapsed <= delayedMetricsMaxAgeMillis) { SlotKey slotKey = SlotKey.of(granularity, entry.getKey(), shard); log.debug(String.format("Delaying re-roll of slotKey [%s] as [%d] millis haven't elapsed " + "since collection time:[%d] now: [%d], last rollup time: [%d]", slotKey, delayedMetricsMaxAgeMillis, update.getTimestamp(), now, update.getLastRollupTimestamp())); continue; } else { granToReRollMeters.get(granularity).mark(); <START> if (nowMillis - update.getTimestamp() >= millisInADay) { <END> granToDelayedMetricsMeter.get(granularity).mark(); } } } } outputKeys.add(entry.getKey()); } return outputKeys; }</code><technical_language>is this check for</technical_language>

Target:
protected List<Integer> getSlotsEligibleForRollup(long now, long maxAgeMillis, long delayedMetricsMaxAgeMillis) { List<Integer> outputKeys = new ArrayList<Integer>(); long nowMillis = new DateTime().getMillis(); for (Map.Entry<Integer, UpdateStamp> entry : slotToUpdateStampMap.entrySet()) { final UpdateStamp update = entry.getValue(); final long timeElapsed = now - update.getTimestamp(); timeSinceUpdate.update(timeElapsed); if (update.getState() == UpdateStamp.State.Rolled) { continue; } if (timeElapsed <= maxAgeMillis) { continue; } if (update.getLastRollupTimestamp() > 0) { final long timeElapsedSinceLastRollup = now - update.getLastRollupTimestamp(); if (timeElapsedSinceLastRollup < REROLL_TIME_SPAN_ASSUMED_VALUE) { if (timeElapsed <= delayedMetricsMaxAgeMillis) { SlotKey slotKey = SlotKey.of(granularity, entry.getKey(), shard); log.debug(String.format("Delaying re-roll of slotKey [%s] as [%d] millis haven't elapsed " + "since collection time:[%d] now: [%d], last rollup time: [%d]", slotKey, delayedMetricsMaxAgeMillis, update.getTimestamp(), now, update.getLastRollupTimestamp())); continue; } else { granToReRollMeters.get(granularity).mark(); if (nowMillis - update.getTimestamp() >= millisInADay) { granToDelayedMetricsMeter.get(granularity).mark(); } } } } outputKeys.add(entry.getKey()); } return outputKeys; }
Source:
<code>private void transferCommittedTail(CorfuRuntime runtime, Layout layout, long committedTail) { final int maxRetry = 3; LogUnitClient logUnitClient = runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(currentNode); for (int i = 0; i < maxRetry; i++) { try { <START> CFUtils.getUninterruptibly(logUnitClient.updateCommittedTail(committedTail), TimeoutException.class, NetworkException.class); <END> return; } catch (TimeoutException | NetworkException e) { log.error("Encountered network issue when transferring new committed tail."); } } }</code><technical_language>update current node's committedTail? update source node's ct</technical_language>

Target:
private void transferCommittedTail(CorfuRuntime runtime, Layout layout, long committedTail) { LogUnitClient logUnitClient = runtime.getLayoutView() .getRuntimeLayout(layout) .getLogUnitClient(currentNode); for (int i = 0; i < retryBase; i++) { try { CFUtils.getUninterruptibly(logUnitClient.updateCommittedTail(committedTail), TimeoutException.class, NetworkException.class); log.debug("transferCommittedTail: transferred committed tail {}", committedTail); return; } catch (TimeoutException | NetworkException e) { log.error("transferCommittedTail: encountered network issue " + "when transferring a new committed tail."); } } log.warn("transferCommittedTail: failed to transfer the latest committed tail of {}.", committedTail); }
Source:
<code>public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } <START> if (isDnsResolverConfigurationSupported()) { <END> addDnsConfiguration(result); } result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork ); return result; }</code><technical_language>is needed, if feature is supported 'engineDefineDnsConfiguration' (in 'addDnsConfiguration(..)') null, is sync functionality anyway. Isn;t it</technical_language>

Target:
public ReportedConfigurations reportConfigurationsOnHost () { ReportedConfigurations result = new ReportedConfigurations(); Integer networkMtu = network.getMtu() == 0 ? NetworkUtils.getDefaultMtu() : network.getMtu(); result.add(ReportedConfigurationType.MTU, iface.getMtu(), networkMtu, isNetworkMtuInSync()); result.add(ReportedConfigurationType.BRIDGED, iface.isBridged(), network.isVmNetwork()); result.add(ReportedConfigurationType.VLAN, iface.getVlanId(), network.getVlanId()); result.add(ReportedConfigurationType.SWITCH_TYPE, iface.getReportedSwitchType(), cluster.getRequiredSwitchTypeForCluster()); addReportedIpv4Configuration(result); boolean reportHostQos = ifaceQos != null || hostNetworkQos != null; if (reportHostQos) { result.add(OUT_AVERAGE_LINK_SHARE, getOutAverageLinkshare(ifaceQos), getOutAverageLinkshare(hostNetworkQos)); result.add(OUT_AVERAGE_UPPER_LIMIT, getOutAverageUpperlimit(ifaceQos), getOutAverageUpperlimit(hostNetworkQos)); result.add(OUT_AVERAGE_REAL_TIME, getOutAverageRealtime(ifaceQos), getOutAverageRealtime(hostNetworkQos)); } addDnsConfiguration(result); result.add(DEFAULT_ROUTE, iface.isIpv4DefaultRoute(), isDefaultRouteNetwork ); return result; }
Source:
<code>public String transform(String jsonPathExpression, String source) throws TransformationException { if (jsonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("about to transform '{}' by the function '{}'", source, jsonPathExpression); try { Object transformationResult = JsonPath.read(source, jsonPathExpression); logger.debug("transformation resulted in '{}'", transformationResult); if (transformationResult == null) { return UnDefType.NULL.toFullString(); } else if (transformationResult instanceof List) { return flattenList((List<?>) transformationResult); } else { return transformationResult.toString(); } } catch (PathNotFoundException e) { <START> return null; <END> } catch (InvalidPathException | InvalidJsonException e) { throw new TransformationException("An error occurred while transforming JSON expression.", e); } }</code><technical_language>Returning null is allowed API contract, #4870</technical_language>

Target:
public String transform(String jsonPathExpression, String source) throws TransformationException { if (jsonPathExpression == null || source == null) { throw new TransformationException("the given parameters 'JSonPath' and 'source' must not be null"); } logger.debug("About to transform '{}' by the function '{}'", source, jsonPathExpression); try { Object transformationResult = JsonPath.read(source, jsonPathExpression); logger.debug("Transformation resulted in '{}'", transformationResult); if (transformationResult == null) { return UnDefType.NULL.toFullString(); } else if (transformationResult instanceof List) { return flattenList((List<?>) transformationResult); } else { return transformationResult.toString(); } } catch (PathNotFoundException e) { logger.debug("Given JSONPath selector expression '" + jsonPathExpression + "' does not match the input string '" + source + "'"); return UnDefType.NULL.toFullString(); } catch (InvalidPathException | InvalidJsonException e) { throw new TransformationException("An error occurred while transforming JSON expression.", e); } }
Source:
<code>public byte[] getBytes(String plainText) { <START> if (!isBase64) { <END> return plainText.getBytes(charset); } else { try { return codec.decode(plainText.getBytes("US-ASCII")); } catch (Exception e) { throw new CompatException(e); } } }</code><technical_language>if (this != Base64) do need isBase64 field</technical_language>

Target:
public byte[] getBytes(String plainText) { if (this != Base64) { return plainText.getBytes(charset); } else { try { return codec.decode(plainText.getBytes("US-ASCII")); } catch (Exception e) { throw new CompatException(e); } } }
Source:
<code>public Result[] next(ResultScanner<Row> resultScanner, ByteKeyRangeTracker rangeTracker) throws IOException { List<Result> results = new ArrayList<>(); for (int i = 0; i < arraySize; i++) { Row row = resultScanner.next(); if (row == null) { break; } <START> ByteKey key = ByteKey.copyFrom(row.getKey().toByteArray()); <END> if (!rangeTracker.tryReturnRecordAt(true, key)) { break; } results.add(Adapters.ROW_ADAPTER.adaptResponse(row)); } return results.toArray(new Result[results.size()]); }</code><technical_language>do this 2 array copies for row ideal. above. create a zero-copy byte string row key create ByteKey that</technical_language>

Target:
public Result[] next(ResultScanner<Row> resultScanner, ByteKeyRangeTracker rangeTracker) throws IOException { List<Result> results = new ArrayList<>(); for (int i = 0; i < arraySize; i++) { Row row = resultScanner.next(); if (row == null) { break; } ByteKey key = toByteKey(row.getKey()); if (!rangeTracker.tryReturnRecordAt(true, key)) { break; } results.add(Adapters.ROW_ADAPTER.adaptResponse(row)); } return results.toArray(new Result[results.size()]); }
Source:
<code>public LogResult postLog(@NonNull final LogType logType, @NonNull final Calendar date, @NonNull final String log, @Nullable final String logPassword, @NonNull final List<TrackableLog> trackableLogs) { try { final CheckBox favCheck = (CheckBox) activity.findViewById(R.id.favorite_check); final ImmutablePair<StatusCode, String> postResult = GCWebAPI.postLog(cache, logType, date.getTime(), log, trackableLogs, favCheck.isChecked()); if (postResult.left == StatusCode.NO_ERROR) { DataStore.saveVisitDate(cache.getGeocode(), date.getTime().getTime()); if (logType.isFoundLog()) { GCLogin.getInstance().increaseActualCachesFound(); } <START> <END> if (logType == LogType.TEMP_DISABLE_LISTING) { cache.setDisabled(true); } else if (logType == LogType.ENABLE_LISTING) { cache.setDisabled(false); } if (favCheck.isChecked()) { cache.setFavorite(true); cache.setFavoritePoints(cache.getFavoritePoints() + 1); } } return new LogResult(postResult.left, postResult.right); } catch (final Exception e) { Log.e("GCLoggingManager.postLog", e); } return new LogResult(StatusCode.LOG_POST_ERROR, ""); }</code><technical_language>else here</technical_language>

Target:
public LogResult postLog(@NonNull final LogType logType, @NonNull final Calendar date, @NonNull final String log, @Nullable final String logPassword, @NonNull final List<TrackableLog> trackableLogs) { try { final CheckBox favCheck = (CheckBox) activity.findViewById(R.id.favorite_check); final ImmutablePair<StatusCode, String> postResult = GCWebAPI.postLog(cache, logType, date.getTime(), log, trackableLogs, favCheck.isChecked()); if (postResult.left == StatusCode.NO_ERROR) { DataStore.saveVisitDate(cache.getGeocode(), date.getTime().getTime()); if (logType.isFoundLog()) { GCLogin.getInstance().increaseActualCachesFound(); } else if (logType == LogType.TEMP_DISABLE_LISTING) { cache.setDisabled(true); } else if (logType == LogType.ENABLE_LISTING) { cache.setDisabled(false); } if (favCheck.isChecked()) { cache.setFavorite(true); cache.setFavoritePoints(cache.getFavoritePoints() + 1); } } return new LogResult(postResult.left, postResult.right); } catch (final Exception e) { Log.e("GCLoggingManager.postLog", e); } return new LogResult(StatusCode.LOG_POST_ERROR, ""); }
Source:
<code>public void json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = encoder.encode(oInstance, ContentFormat.JSON, new LwM2mPath("/3/0"), model); StringBuilder b = new StringBuilder(); b.append("{\"e\":["); b.append("{\"n\":\"0\",\"sv\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"sv\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"sv\":\"345000123\"},"); b.append("{\"n\":\"3\",\"sv\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11\",\"v\":0},"); <START> b.append("{\"n\":\"13\",\"v\":1.367491215E9},"); <END> b.append("{\"n\":\"14\",\"sv\":\"+02:00\"},"); b.append("{\"n\":\"15\",\"sv\":\"U\"}]}"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }</code><technical_language>want exponent</technical_language>

Target:
public void json_encode_device_object_instance() { LwM2mObjectInstance oInstance = new LwM2mObjectInstance(0, getDeviceResources()); byte[] encoded = encoder.encode(oInstance, ContentFormat.JSON, new LwM2mPath("/3/0"), model); StringBuilder b = new StringBuilder(); b.append("{\"bn\":\"/3/0\",\"e\":["); b.append("{\"n\":\"0\",\"sv\":\"Open Mobile Alliance\"},"); b.append("{\"n\":\"1\",\"sv\":\"Lightweight M2M Client\"},"); b.append("{\"n\":\"2\",\"sv\":\"345000123\"},"); b.append("{\"n\":\"3\",\"sv\":\"1.0\"},"); b.append("{\"n\":\"6/0\",\"v\":1},"); b.append("{\"n\":\"6/1\",\"v\":5},"); b.append("{\"n\":\"7/0\",\"v\":3800},"); b.append("{\"n\":\"7/1\",\"v\":5000},"); b.append("{\"n\":\"8/0\",\"v\":125},"); b.append("{\"n\":\"8/1\",\"v\":900},"); b.append("{\"n\":\"9\",\"v\":100},"); b.append("{\"n\":\"10\",\"v\":15},"); b.append("{\"n\":\"11\",\"v\":0},"); b.append("{\"n\":\"13\",\"v\":1.367491215E9},"); b.append("{\"n\":\"14\",\"sv\":\"+02:00\"},"); b.append("{\"n\":\"15\",\"sv\":\"U\"}]}"); String expected = b.toString(); Assert.assertEquals(expected, new String(encoded)); }
Source:
<code>public <START> @Gutter int <END> getGutter() { return mGutter; }</code><technical_language>This method. Is auto-formatter making this way? If so, fine, code inconsistent</technical_language>

Target:
public int getGutter() { return mGutter; }
Source:
<code>private GlusterGeoRepSessionConfiguration getConfig(Map<String, Object> innerMap) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setKey(innerMap.containsKey(OPTION_NAME) ? (String)innerMap.get(OPTION_NAME) : null); <START> config.setValue(innerMap.containsKey(DESCRIPTION) ? (String) innerMap.get(DESCRIPTION) : null); <END> return config; }</code><technical_language>Is "description" key for in returned map</technical_language>

Target:
private GlusterGeoRepSessionConfiguration getConfig(Map<String, Object> innerMap) { GlusterGeoRepSessionConfiguration config = new GlusterGeoRepSessionConfiguration(); config.setKey(innerMap.containsKey(OPTION_NAME) ? (String)innerMap.get(OPTION_NAME) : null); config.setValue(innerMap.containsKey(OPTION_VALUE) ? (String) innerMap.get(OPTION_VALUE) : null); return config; }
Source:
<code><START> public void tearDown() throws IOException{ <END> StorageOperations.deleteDir(new File(PathBuilder.buildProjectPath("testProject"))); }</code><technical_language>White space missing IOException. [checkstyle report](<LINK_0></technical_language>

Target:
public void tearDown() throws IOException { StorageOperations.deleteDir(new File(PathBuilder.buildProjectPath(getClass().getSimpleName()))); }
Source:
<code>protected Command dropAssociation(final DropObjectsRequest dropRequest, final Element semanticLink) { Collection<?> endtypes = ClassLinkMappingHelper.getInstance().getSource(semanticLink); if (endtypes.size() == 1) { Element source = (Element) endtypes.toArray()[0]; Element target = (Element) endtypes.toArray()[0]; return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() == 2) { Element source = null; Element target = null; final List<Property> memberEnds = ((Association) semanticLink).getMemberEnds(); if <START> (memberEnds.get(0).equals(endtypes.toArray()[0])) <END> { source = (Element) endtypes.toArray()[0]; target = (Element) endtypes.toArray()[1]; } else { source = (Element) endtypes.toArray()[1]; target = (Element) endtypes.toArray()[0]; } return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() > 2) { MultiAssociationHelper associationHelper = new MultiAssociationHelper(getEditingDomain()); return associationHelper.dropMutliAssociation((Association) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView()); } return UnexecutableCommand.INSTANCE; }</code><technical_language>useless calls toArray() allocation/copy of a new array. endtypes.get(0) endtypes.get(1) instead? (no allocation all). Probably, ClassLinkMappingHelper.getSource() return a List instead of a plain Collection.</technical_language>

Target:
protected Command dropAssociation(final DropObjectsRequest dropRequest, final Element semanticLink) { final List<?> endtypes = new ArrayList<>(ClassLinkMappingHelper.getInstance().getSource(semanticLink)); if (endtypes.size() == 1) { Element source = (Element) endtypes.get(0); Element target = (Element) endtypes.get(0); return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() == 2) { Element source = null; Element target = null; final List<Property> memberEnds = ((Association) semanticLink).getMemberEnds(); if (memberEnds.get(0).equals(endtypes.get(0))) { source = (Element) endtypes.get(0); target = (Element) endtypes.get(1); } else { source = (Element) endtypes.get(1); target = (Element) endtypes.get(0); } return new ICommandProxy(dropBinaryLink(new CompositeCommand("drop Association"), source, target, AssociationEditPart.VISUAL_ID, dropRequest.getLocation(), semanticLink)); } if (endtypes.size() > 2) { MultiAssociationHelper associationHelper = new MultiAssociationHelper(getEditingDomain()); return associationHelper.dropMutliAssociation((Association) semanticLink, getViewer(), getDiagramPreferencesHint(), dropRequest.getLocation(), ((GraphicalEditPart) getHost()).getNotationView()); } return UnexecutableCommand.INSTANCE; }
Source:
<code>public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); <START> copy.setAttributes(this.getAttributes()); <END> return copy; }</code><technical_language>need careful this creating clones. copy a reference map, basically adding map itself, result in a no-op effectively, point decoupled copy source. work this, set attributes null, set attributes map source if is null itself</technical_language>

Target:
public GuestIdDTO clone() { GuestIdDTO copy = super.clone(); Map<String, String> attributes = this.getAttributes(); copy.setAttributes(null); if (attributes != null) { copy.setAttributes(attributes); } return copy; }
Source:
<code>public static String encrypt(ServletContext ctx, String rawText) throws Exception { SsoLocalConfig config = getSsoContext(ctx).getSsoLocalConfig(); try (InputStream in = new FileInputStream(config.getPKIEngineCert().getAbsoluteFile())) { return EnvelopeEncryptDecrypt.encrypt( "AES/OFB/PKCS5Padding", 256, CertificateFactory.getInstance("X.509").generateCertificate(in), 100, rawText.getBytes(StandardCharsets.UTF_8)); <START> } <END> }</code><technical_language>This is a heavy method. requires a file access, verification of integrity of keystore, decoding of X.509 certificate, finally encryption. for API session. Do want do that? is purpose of encrypting password? Is stored in database in memory? If is store in memory I useful, clear text password stored in memory, memory is garbage collected cleaned, happen. suggest avoid this store unencrypted password. If decide encrypt it, suggest pre-load certificate, avoid repeated file access</technical_language>

Target:
public static String encrypt(ServletContext ctx, String rawText) throws Exception { return EnvelopeEncryptDecrypt.encrypt( "AES/OFB/PKCS5Padding", 256, getSsoContext(ctx).getEngineCertificate(), 100, rawText.getBytes(StandardCharsets.UTF_8)); }