auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ActionResponseDto executeBundleAction(final DlmsConnectionHolder conn, final DlmsDevice device, final ActionRequestDto actionRequestDto) throws ProtocolAdapterException, FunctionalException { this.checkActionRequestType(actionRequestDto); <START> LOGGER.info("Keys to set on the device {}: {}", device.getDeviceIdentification(), actionRequestDto); <END> DlmsDevice devicePostSave = this.execute(conn, device, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getAuthenticationKey(), KeyId.AUTHENTICATION_KEY, SecurityKeyType.E_METER_AUTHENTICATION)); devicePostSave = this.execute(conn, devicePostSave, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getEncryptionKey(), KeyId.GLOBAL_UNICAST_ENCRYPTION_KEY, SecurityKeyType.E_METER_ENCRYPTION)); return new ActionResponseDto(REPLACE_KEYS + device.getDeviceIdentification() + WAS_SUCCESFULL); }</code><technical_language>Is this method secure? Putting keys in a log file</technical_language>

Target:
public ActionResponseDto executeBundleAction(final DlmsConnectionHolder conn, final DlmsDevice device, final ActionRequestDto actionRequestDto) throws ProtocolAdapterException, FunctionalException { this.checkActionRequestType(actionRequestDto); LOGGER.info("Keys set on device :{}", device.getDeviceIdentification()); DlmsDevice devicePostSave = this.execute(conn, device, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getAuthenticationKey(), KeyId.AUTHENTICATION_KEY, SecurityKeyType.E_METER_AUTHENTICATION)); devicePostSave = this.execute(conn, devicePostSave, ReplaceKeyCommandExecutor.wrap(((SetKeysRequestDto) actionRequestDto).getEncryptionKey(), KeyId.GLOBAL_UNICAST_ENCRYPTION_KEY, SecurityKeyType.E_METER_ENCRYPTION)); return new ActionResponseDto(REPLACE_KEYS + device.getDeviceIdentification() + WAS_SUCCESFULL); }
Source:
<code>public List<IDescriptionLinkResolver> getDescriptionConverterLinkResolvers() { List<IDescriptionLinkResolver> linkResolvers = new ArrayList<>(); linkResolvers.add(new PropertyValidationRuleLinkResolver()); List<IItemDescriptor<IDescriptionLinkResolver>> itemDescriptors = this.descriptionConverterLinkResolverRegistry.getItemDescriptors(); <START> for (IItemDescriptor<IDescriptionLinkResolver> itemDescriptor : itemDescriptors) { IDescriptionLinkResolver linkResolver = itemDescriptor.getItem(); linkResolvers.add(linkResolver); } <END> return linkResolvers; }</code><technical_language>java8-isation [forEach][map][methodReference]</technical_language>

Target:
public List<IDescriptionLinkResolver> getDescriptionConverterLinkResolvers() { if (!this.hasReadDescriptionConverterLinkResolverRegistry) { this.descriptionConverterLinkResolverListener.readRegistry(Platform.getExtensionRegistry()); this.hasReadDescriptionConverterLinkResolverRegistry = true; } List<IDescriptionLinkResolver> linkResolvers = new ArrayList<>(); linkResolvers.add(new PropertyValidationRuleLinkResolver()); List<IItemDescriptor<IDescriptionLinkResolver>> itemDescriptors = this.descriptionConverterLinkResolverRegistry.getItemDescriptors(); itemDescriptors.stream().map(IItemDescriptor::getItem).map(linkResolvers::add); return linkResolvers; }
Source:
<code>private Map configPropertiesAsMap(TaskConfig taskConfig) { HashMap properties = new HashMap(); for (Property property : taskConfig.list()) { final HashMap propertyValue = new HashMap(); propertyValue.put("value", property.getValue()); propertyValue.put("secure", property.getOption(Property.SECURE)); propertyValue.put("required", property.getOption(Property.REQUIRED)); <START> propertyValue.put("display-name", property.getOption(Property.DISPLAY_NAME)); <END> propertyValue.put("display-order", property.getOption(Property.DISPLAY_ORDER).toString()); properties.put(property.getKey(), propertyValue); } return properties; }</code><technical_language>i understand need for display-name & display-order</technical_language>

Target:
private Map configPropertiesAsMap(TaskConfig taskConfig) { HashMap properties = new HashMap(); for (Property property : taskConfig.list()) { final HashMap propertyValue = new HashMap(); propertyValue.put("value", property.getValue()); propertyValue.put("secure", property.getOption(Property.SECURE)); propertyValue.put("required", property.getOption(Property.REQUIRED)); properties.put(property.getKey(), propertyValue); } return properties; }
Source:
<code>protected void doExecute() { try { ModelSet modelSet = ServiceUtilsForEObject.getInstance().getModelSet(targetOwner); IModel notationModel = modelSet.getModelFor(newElement); if (notationModel instanceof IEMFModel) { <START> Resource notationResource = ((IEMFModel) notationModel).getResource(); <END> EList<EObject> contents = notationResource.getContents(); int location = contents.indexOf(objectLocation); if (location != -1) { contents.move(location, newElement); } notationResource.setModified(true); } } catch (ServiceException e) { } }</code><technical_language>Controlled diagrams (and imported diagrams, i.e. diagrams imported libraries) stored in this notation resource</technical_language>

Target:
protected void doExecute() { Resource notationResource = newElement.eResource(); if (notationResource != null) { EList<EObject> contents = notationResource.getContents(); int location = contents.indexOf(objectLocation); if (location != -1) { contents.move(location, newElement); notationResource.setModified(true); } } }
Source:
<code>public void testMultipleSchemas() throws Exception { PgConnection pgConnection = con.unwrap(PgConnection.class); String previousSchema = pgConnection.getSchema(); TestUtil.createSchema(con, "schema_update_row"); pgConnection.setSchema("schema_update_row"); TestUtil.createTable(con, "second", "id1 int, name1 text, name2 text, constraint second_pk primary key (id1, name2)"); Statement st2 = con.createStatement(); st2.execute("insert into second values (1,'anyvalue', 'anyvalue2')"); pgConnection.setSchema(previousSchema); Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("select id1, name1 from second"); rs.next(); rs.updateString("name1", "newval"); <START> rs.updateRow(); <END> rs.close(); }</code><technical_language>Please add assertion verify update succeeds</technical_language>

Target:
public void testMultipleSchemas() throws Exception { PgConnection pgConnection = con.unwrap(PgConnection.class); String previousSchema = pgConnection.getSchema(); TestUtil.createSchema(con, "schema_update_row"); pgConnection.setSchema("schema_update_row"); TestUtil.createTable(con, "second", "id1 int, name1 text, name2 text, constraint second_pk primary key (id1, name2)"); Statement st2 = con.createStatement(); st2.execute("insert into second values (1,'anyvalue', 'anyvalue2')"); pgConnection.setSchema(previousSchema); Statement st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = st.executeQuery("select id1, name1 from second"); rs.next(); rs.updateString("name1", "newval"); rs.updateRow(); rs.close(); @Test public void simpleAndUpdateableSameQuery() throws Exception { PGConnection unwrap = con.unwrap(PGConnection.class); Assume.assumeNotNull(unwrap); int prepareThreshold = unwrap.getPrepareThreshold(); String sql = "select * from second where id1=?"; for (int i = 0; i <= prepareThreshold; i++) { PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(sql); ps.setInt(1, 1); rs = ps.executeQuery(); rs.next(); String name1 = rs.getString("name1"); Assert.assertEquals("anyvalue", name1); int id1 = rs.getInt("id1"); Assert.assertEquals(1, id1); } finally { TestUtil.closeQuietly(rs); TestUtil.closeQuietly(ps); } } { PreparedStatement ps = null; ResultSet rs = null; try { ps = con.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ps.setInt(1, 1); rs = ps.executeQuery(); rs.next(); String name1 = rs.getString("name1"); Assert.assertEquals("anyvalue", name1); int id1 = rs.getInt("id1"); Assert.assertEquals(1, id1); rs.updateString("name1", "updatedValue"); rs.updateRow(); } finally { TestUtil.closeQuietly(rs); TestUtil.closeQuietly(ps); } } } }
Source:
<code>private void log(Exception exception) { CPSApplicationUIPlugin.getDefault().logException("An error <START> happaned: " <END> + exception.getMessage(), exception); }</code><technical_language>misspelled error message</technical_language>

Target:
private void log(Exception exception) { CPSApplicationUIPlugin.getDefault().logException("An error happened: " + exception.getMessage(), exception); }
Source:
<code>protected void toggleGhost(KeyValueLineModel value, KeyValueLineWidget widget, boolean becomingGhost) { super.toggleGhost(value, widget, becomingGhost); <START> widget.setEnabled(!becomingGhost); <END> widget.keyField.setEnabled(true); }</code><technical_language>1. Consider moving code parent toggleGhost 2. consider 'enabled'</technical_language>

Target:
protected void toggleGhost(KeyValueLineModel value, KeyValueLineWidget widget, boolean becomingGhost) { if (!widget.isEnabled()) { return; } super.toggleGhost(value, widget, becomingGhost); widget.setEnabled(!becomingGhost); widget.keyField.setEnabled(true); }
Source:
<code>public void setItemCountEstimateIncrease(int itemCountEstimateIncrease) { if (itemCountEstimateIncrease < 1) { throw new IllegalArgumentException( "itemCountEstimateIncrease cannot be less than 1"); } this.itemCountEstimateIncrease = itemCountEstimateIncrease; this.countCallback = null; <START> this.definedSize = false; <END> }</code><technical_language>Unrelated unnecessary change (yes this. for countCallback is unnecessary too)</technical_language>

Target:
public void setItemCountEstimateIncrease(int itemCountEstimateIncrease) { if (itemCountEstimateIncrease < 1) { throw new IllegalArgumentException( "itemCountEstimateIncrease cannot be less than 1"); } this.itemCountEstimateIncrease = itemCountEstimateIncrease; countCallback = null; definedSize = false; }
Source:
<code>public boolean unregisterOutput(String id) { <START> return watermarkPerOutputId.remove(id) != null; <END> }</code><technical_language>Ah no, I think. of removing instance equals works..</technical_language>

Target:
public boolean unregisterOutput(String id) { final OutputState output = watermarkPerOutputId.remove(id); if (output != null) { watermarkOutputs.remove(output); return true; } else { return false; } }
Source:
<code>public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( uniqueIndex ); ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); <START> verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); <END> }</code><technical_language>this verify is reachable now, I missing something</technical_language>

Target:
public void shouldDisallowAddingIndexWhenConstraintIndexExists() throws Exception { SchemaReadOperations innerRead = mock( SchemaReadOperations.class ); SchemaWriteOperations innerWrite = mock( SchemaWriteOperations.class ); DataIntegrityValidatingStatementOperations ctx = new DataIntegrityValidatingStatementOperations( null, innerRead, innerWrite ); when( innerRead.indexGetForLabelAndPropertyKey( state, SchemaBoundary.map( descriptor ) ) ).thenReturn( uniqueIndex ); try { ctx.indexCreate( state, descriptor ); fail( "Should have thrown exception." ); } catch ( AlreadyConstrainedException e ) { } verify( innerWrite, never() ).indexCreate( eq( state ), anyObject() ); }
Source:
<code>public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, <START> final Map<String, String> customValues) { <END> AuditLogDirector.log(new AuditLogableBase() { @Override protected VDS getVds() { return server; } @Override public VDSGroup getVdsGroup() { setVdsGroupId(clusterId); return super.getVdsGroup(); } @Override protected GlusterVolumeEntity getGlusterVolume() { return volume; } @Override public AuditLogType getAuditLogTypeValue() { return logType; } @Override public Map<String, String> getCustomValues() { return customValues; } }); }</code><technical_language>a thought - create instance of AuditLogableBase call setters them, instead of overriding getters</technical_language>

Target:
public void logAuditMessage(final Guid clusterId, final GlusterVolumeEntity volume, final VDS server, final AuditLogType logType, final Map<String, String> customValues) { AuditLogableBase logable = new AuditLogableBase(); logable.setAuditLogType(logType); logable.setVds(server); logable.setGlusterVolume(volume); logable.setVdsGroupId(clusterId == null ? Guid.Empty : clusterId); if (customValues != null) { for (String key : customValues.keySet()) { logable.addCustomValue(key, customValues.get(key)); } } AuditLogDirector.log(logable); }
Source:
<code>public CompletionStage<Void> handle(CacheEntryCreatedEvent e) { if (e.isPre()) { caller = Thread.currentThread(); latch.countDown(); } <START> return null; <END> }</code><technical_language>test a listener returns incomplete stage well? fair this test is weird, test a lot asynchronous notification :)</technical_language>

Target:
public CompletionStage<Void> handle(CacheEntryCreatedEvent e) { if (e.isPre()) { caller = Thread.currentThread(); latch.countDown(); } return CompletableFutures.completedNull(); }
Source:
<code>private boolean delete(Media media, String reason) { String editToken; String authCookie; String summary = "Nominating " + media.getFilename() + " for deletion."; authCookie = sessionManager.getAuthCookie(); mwApi.setAuthCookie(authCookie); Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); <START> String userPageString = "\n" + "{{subst:idw|" + media.getFilename() + <END> "}} ~~~~"; try { editToken = mwApi.getEditToken(); if(editToken == null) { return false; } mwApi.prependEdit(editToken, fileDeleteString + "\n", media.getFilename(), summary); mwApi.edit(editToken, subpageString + "\n", "Commons:Deletion_requests/" + media.getFilename(), summary); mwApi.appendEdit(editToken, logPageString + "\n", "Commons:Deletion_requests/" + date, summary); mwApi.appendEdit(editToken, userPageString + "\n", "User_Talk:" + media.getCreator(), summary); } catch (Exception e) { Timber.e(e); return false; } return true; }</code><technical_language>This liine edited</technical_language>

Target:
private boolean delete(Media media, String reason) { String editToken; String authCookie; String summary = "Nominating " + media.getFilename() + " for deletion."; authCookie = sessionManager.getAuthCookie(); mwApi.setAuthCookie(authCookie); Calendar calendar = Calendar.getInstance(); String fileDeleteString = "{{delete|reason=" + reason + "|subpage=" + media.getFilename() + "|day=" + calendar.get(Calendar.DAY_OF_MONTH) + "|month=" + calendar.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.getDefault()) + "|year=" + calendar.get(Calendar.YEAR) + "}}"; String subpageString = "=== [[:" + media.getFilename() + "]] ===\n" + reason + " ~~~~"; String logPageString = "\n{{Commons:Deletion requests/" + media.getFilename() + "}}\n"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault()); String date = sdf.format(calendar.getTime()); String userPageString = "\n{{subst:idw|" + media.getFilename() + "}} ~~~~"; try { editToken = mwApi.getEditToken(); if(editToken == null) { return false; } mwApi.prependEdit(editToken, fileDeleteString + "\n", media.getFilename(), summary); mwApi.edit(editToken, subpageString + "\n", "Commons:Deletion_requests/" + media.getFilename(), summary); mwApi.appendEdit(editToken, logPageString + "\n", "Commons:Deletion_requests/" + date, summary); mwApi.appendEdit(editToken, userPageString + "\n", "User_Talk:" + media.getCreator(), summary); } catch (Exception e) { Timber.e(e); return false; } return true; }
Source:
<code>public Iterable<String> getLocationIds() { if (isInitialManagementContextReal()) { return ((LocationManagerInternal)initialManagementContext.getLocationManager()).getLocationIds(); } else { <START> return null; <END> } }</code><technical_language>Is RebindManagerImpl a NonDeploymentManagementContext? This throw NPE if yes. Safer return empty iterable</technical_language>

Target:
public Iterable<String> getLocationIds() { if (isInitialManagementContextReal()) { return ((LocationManagerInternal)initialManagementContext.getLocationManager()).getLocationIds(); } else { return Collections.emptyList(); } }
Source:
<code>public JSONObject toJson(String[] selectedResults) { JSONObject test = new JSONObject(); test.put("name",this.testName); test.put("description",this.testDescription); JSONArray jsonParams = new JSONArray(); for (int i = 0; i < parameters.size(); i++) { JSONObject param = parameters.get(i).toJson(); jsonParams.put(param); } test.put("parameters",parameters); JSONArray jsonMetrics = new JSONArray(); <START> if (selectedResults == null) <END> { for (HashMap.Entry<String, AveragedMetric> entry : metrics.entrySet()) { AveragedMetric metric = entry.getValue(); metric.discardOutliers(); JSONObject obj = serializeMetric(metric,false); jsonMetrics.put(obj); } } else { for (int i = 0; i < selectedResults.length; i++) { AveragedMetric metric = metrics.get(selectedResults[i]); if (metric == null) { continue; } metric.discardOutliers(); JSONObject obj = serializeMetric(metric,false); jsonMetrics.put(obj); } } test.put("results",jsonMetrics); return test; }</code><technical_language>selectedResults.length == 0</technical_language>

Target:
public JSONObject toJson(String[] selectedResults) { JSONObject test = new JSONObject(); test.put("name",this.testName); test.put("description",this.testDescription); JSONArray jsonParams = new JSONArray(); for (int i = 0; i < parameters.size(); i++) { JSONObject param = parameters.get(i).toJson(); jsonParams.put(param); } test.put("parameters",parameters); JSONArray jsonMetrics = new JSONArray(); if (selectedResults == null || selectedResults.length == 0) { for (HashMap.Entry<String, MetricInfo> entry : metrics.entrySet()) { MetricInfo metricInfo = entry.getValue(); if (metricInfo == null || metricInfo.metric == null) { continue; } JSONObject obj = serializeMetric(metricInfo,false); jsonMetrics.put(obj); } } else { for (int i = 0; i < selectedResults.length; i++) { MetricInfo metricInfo = metrics.get(selectedResults[i]); if (metricInfo == null || metricInfo.metric == null) { continue; } JSONObject obj = serializeMetric(metricInfo,false); jsonMetrics.put(obj); } } test.put("results",jsonMetrics); return test; }
Source:
<code>protected PageProvider<LogEntry> getPageProvider(String name, int pageSize, int currentPage, Object... parameters) { <START> final List<SortInfo> sorters = List.of(new SortInfo("eventDate", true)); <END> @SuppressWarnings("unchecked") PageProvider<LogEntry> pageProvider = (PageProvider<LogEntry>) pageProviderService.getPageProvider(name, sorters, Long.valueOf(pageSize), Long.valueOf(currentPage), Map.of(), parameters); return pageProvider; }</code><technical_language>final needed no</technical_language>

Target:
protected PageProvider<LogEntry> getPageProvider(String name, int pageSize, int currentPage, Object... parameters) { List<SortInfo> sorters = List.of(new SortInfo("id", true)); @SuppressWarnings("unchecked") PageProvider<LogEntry> pageProvider = (PageProvider<LogEntry>) pageProviderService.getPageProvider(name, sorters, Long.valueOf(pageSize), Long.valueOf(currentPage), Map.of(), parameters); return pageProvider; }
Source:
<code>GdkRGBA gtk_css_parse_foreground (String css, String precise) { if (css.isEmpty()) return COLOR_WIDGET_FOREGROUND_RGBA; String shortOutput; int startIndex; GdkRGBA rgba = new GdkRGBA (); String searched = ""; if (precise != null) { if (css.contains(precise)) { searched = css.substring(css.indexOf(precise)); } } else { searched = css; } if (searched.isEmpty()) { return COLOR_WIDGET_FOREGROUND_RGBA; } Matcher m = r.matcher(searched); if (m.find()) { String match = m.group(0); if <START> (match.contains("color:")) { <END> startIndex = match.indexOf("color:"); shortOutput = match.substring(startIndex + 7); rgba = gtk_css_property_to_rgba(shortOutput); } } else { return COLOR_WIDGET_FOREGROUND_RGBA; } return rgba; }</code><technical_language>Unnecessary. This is true</technical_language>

Target:
GdkRGBA gtk_css_parse_foreground (String css, String precise) { if (css.isEmpty()) return COLOR_WIDGET_FOREGROUND_RGBA; String shortOutput; int startIndex; GdkRGBA rgba = new GdkRGBA (); String searched = ""; if (precise != null) { if (css.contains(precise)) { searched = css.substring(css.indexOf(precise)); } } else { searched = css; } if (searched.isEmpty()) { return COLOR_WIDGET_FOREGROUND_RGBA; } Matcher m = colorPattern.matcher(searched); if (m.find()) { String match = m.group(0); if (match.contains("color:")) { startIndex = match.indexOf("color:"); shortOutput = match.substring(startIndex + 7); rgba = gtk_css_property_to_rgba(shortOutput); } } else { return COLOR_WIDGET_FOREGROUND_RGBA; } return rgba; }
Source:
<code>protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || <START> !projectControl.allRefsAreVisible()) { <END> throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes()); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }</code><technical_language>This is pretty onerous client. If this is false load a VisibleRefFilter if asking for a tree a current branch tip, tag, a patch set see. do RefControl.isMergedIntoBranchOrTag check if a sane revision reachable for caller</technical_language>

Target:
protected void runImpl() throws IOException, Failure { PacketLineOut packetOut = new PacketLineOut(out); packetOut.setFlushOnEnd(true); packetOut.writeString("ACK"); packetOut.end(); try { readArguments(); if (!uploadArchiveAllowed || !projectControl.allRefsAreVisible()) { throw new Failure(4, "fatal: upload-archive not permitted on this" + "server"); } ObjectId treeId = repo.resolve(options.treeIsh); if (treeId.equals(ObjectId.zeroId())) { throw new Failure(5, "fatal: reference not found"); } String format = options.format; boolean wasFormatRegistered = registerArchiveFormat(format); try { SideBandOutputStream sidebandOut = new SideBandOutputStream(SideBandOutputStream.CH_DATA, SideBandOutputStream.MAX_BUF, out); new ArchiveCommand(repo) .setFormat(format) .setTree(treeId) .setPaths(options.path.toArray(new String[0])) .setPrefix(options.prefix) .setOutputStream(sidebandOut) .call(); sidebandOut.flush(); sidebandOut.close(); } catch (GitAPIException e) { throw new Failure(6, "fatal: git api exception, " + e); } finally { if (wasFormatRegistered) { unregisterArchiveFormat(format); } } } catch (Failure f) { SideBandOutputStream sidebandError = new SideBandOutputStream(SideBandOutputStream.CH_ERROR, SideBandOutputStream.MAX_BUF, out); sidebandError.write(f.getMessage().getBytes("UTF-8")); sidebandError.flush(); sidebandError.close(); throw f; } finally { packetOut.end(); } }
Source:
<code>private PieData getData() { PieDataSet dataSet = new PieDataSet(null, ""); List<String> labels = new ArrayList<>(); List<Integer> colors = new ArrayList<>(); for (Account account : mAccountsDbAdapter.getSimpleAccountList()) { if (account.getAccountType() == AccountType.EXPENSE && !account.isPlaceholderAccount() <START> && account.getCommodity() == mCommodity) { <END> long start = new LocalDate().minusMonths(2).dayOfMonth().withMinimumValue().toDate().getTime(); long end = new LocalDate().plusDays(1).toDate().getTime(); double balance = mAccountsDbAdapter.getAccountsBalance( Collections.singletonList(account.getUID()), start, end).asDouble(); if (balance > 0) { dataSet.addEntry(new Entry((float) balance, dataSet.getEntryCount())); colors.add(account.getColor() != Account.DEFAULT_COLOR ? account.getColor() : ReportsActivity.COLORS[(dataSet.getEntryCount() - 1) % ReportsActivity.COLORS.length]); labels.add(account.getName()); } } } dataSet.setColors(colors); dataSet.setSliceSpace(PieChartFragment.SPACE_BETWEEN_SLICES); return new PieData(labels, dataSet); }</code><technical_language>Java Currency class Singletons, == operator work for them. I Commodity works this moment. singletons means equals() method instead. properly implemented for Commodity class</technical_language>

Target:
private PieData getData() { PieDataSet dataSet = new PieDataSet(null, ""); List<String> labels = new ArrayList<>(); List<Integer> colors = new ArrayList<>(); for (Account account : mAccountsDbAdapter.getSimpleAccountList()) { if (account.getAccountType() == AccountType.EXPENSE && !account.isPlaceholderAccount() && account.getCommodity().equals(mCommodity)) { long start = new LocalDate().minusMonths(2).dayOfMonth().withMinimumValue().toDate().getTime(); long end = new LocalDate().plusDays(1).toDate().getTime(); double balance = mAccountsDbAdapter.getAccountsBalance( Collections.singletonList(account.getUID()), start, end).asDouble(); if (balance > 0) { dataSet.addEntry(new Entry((float) balance, dataSet.getEntryCount())); colors.add(account.getColor() != Account.DEFAULT_COLOR ? account.getColor() : ReportsActivity.COLORS[(dataSet.getEntryCount() - 1) % ReportsActivity.COLORS.length]); labels.add(account.getName()); } } } dataSet.setColors(colors); dataSet.setSliceSpace(PieChartFragment.SPACE_BETWEEN_SLICES); return new PieData(labels, dataSet); }
Source:
<code>public Boolean showRemoveButton() { if (_showRemoveButton == null) { boolean isRemoveable = ERXValueUtilities.booleanValueWithDefault(d2wContext().valueForKey("isEntityRemoveable"), false); EODataSource ds = dataSource(); if (ds!= null && ds instanceof EODetailDataSource) { EODetailDataSource dds = (EODetailDataSource)ds; EOEnterpriseObject masterObj = (EOEnterpriseObject)dds.masterObject(); EOEntity masterEntity = ERXEOAccessUtilities.entityForEo(masterObj); EORelationship relationship = masterEntity.relationshipNamed(dds.detailKey()); EORelationship reverseRelationship = relationship.inverseRelationship(); if(isRemoveable && !relationship.ownsDestination()) { <START> if (!relationship.ownsDestination()) { <END> if (reverseRelationship == null) { _showRemoveButton = Boolean.TRUE; } else { _showRemoveButton = !reverseRelationship.isMandatory(); } } } else { _showRemoveButton = Boolean.FALSE; } } else { _showRemoveButton = Boolean.valueOf(isRemoveable); } } return _showRemoveButton; }</code><technical_language>purpose this check? This evaluate true in line is part of if-condition</technical_language>

Target:
public Boolean showRemoveButton() { if (_showRemoveButton == null) { boolean isRemoveable = ERXValueUtilities.booleanValueWithDefault(d2wContext().valueForKey("isEntityRemoveable"), false); EODataSource ds = dataSource(); if (ds!= null && ds instanceof EODetailDataSource) { EODetailDataSource dds = (EODetailDataSource)ds; EOEnterpriseObject masterObj = (EOEnterpriseObject)dds.masterObject(); EOEntity masterEntity = ERXEOAccessUtilities.entityForEo(masterObj); EORelationship relationship = masterEntity.relationshipNamed(dds.detailKey()); EORelationship reverseRelationship = relationship.inverseRelationship(); if(isRemoveable && !relationship.ownsDestination()) { if (reverseRelationship == null) { _showRemoveButton = Boolean.TRUE; } else { _showRemoveButton = !reverseRelationship.isMandatory(); } } else { _showRemoveButton = Boolean.FALSE; } } else { _showRemoveButton = Boolean.valueOf(isRemoveable); } } return _showRemoveButton; }
Source:
<code>public static String generatePartitionPath(LinkedHashMap<String, String> partitionSpec) { StringBuilder suffixBuf = new StringBuilder(); int i = 0; for (Map.Entry<String, String> e : partitionSpec.entrySet()) { if (i > 0) { suffixBuf.append(Path.SEPARATOR); } suffixBuf.append(escapePathName(e.getKey())); suffixBuf.append('='); suffixBuf.append(escapePathName(e.getValue())); i++; } <START> if (partitionSpec.size() > 0) { <END> suffixBuf.append(Path.SEPARATOR); } return suffixBuf.toString(); }</code><technical_language>move judgement code path short</technical_language>

Target:
public static String generatePartitionPath(LinkedHashMap<String, String> partitionSpec) { if (partitionSpec.isEmpty()) { return ""; } StringBuilder suffixBuf = new StringBuilder(); int i = 0; for (Map.Entry<String, String> e : partitionSpec.entrySet()) { if (i > 0) { suffixBuf.append(Path.SEPARATOR); } suffixBuf.append(escapePathName(e.getKey())); suffixBuf.append('='); suffixBuf.append(escapePathName(e.getValue())); i++; } suffixBuf.append(Path.SEPARATOR); return suffixBuf.toString(); }
Source:
<code>public ListBoxModel doFillTimeZoneNameItems() { String current = forCurrentUser(); ListBoxModel items = new ListBoxModel(); <START> items.add(""); END> for (String id : TimeZone.getAvailableIDs()) { if (id.equalsIgnoreCase(current)) { items.add(new Option(id, id, true)); } else { items.add(id); } } Messages.TimeZoneProperty_DisplayName(); return items; }</code><technical_language>show Default System default users confused empty value</technical_language>

Target:
public ListBoxModel doFillTimeZoneNameItems() { String current = forCurrentUser(); ListBoxModel items = new ListBoxModel(); items.add(Messages.TimeZoneProperty_DisplayDefaultTimeZone(), ""); for (String id : TimeZone.getAvailableIDs()) { if (id.equalsIgnoreCase(current)) { items.add(new Option(id, id, true)); } else { items.add(id); } } return items; }
Source:
<code>public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<String, String> builder = ImmutableMap.<String, String> builder() .put("Source Port", String.valueOf(fSourcePort)) .put("Destination Port", String.valueOf(fDestinationPort)) .put("Sequence Number", String.valueOf(fSequenceNumber)) .put("Acknowledgement Number", String.valueOf(fAcknowledgmentNumber)) .put("Length", String.valueOf(fDataOffset * TCPValues.BLOCK_SIZE) + " bytes") .put("ECN-Nonce Flag", String.valueOf(fNSFlag)) .put("Congestion Window Reduced Flag", String.valueOf(fCWRFlag)) .put("ECN-Echo Flag", String.valueOf(fECEFlag)) .put("Urgent Flag", String.valueOf(fURGFlag)) .put("ACK Flag", String.valueOf(fACKFlag)) .put("PSH Flag", String.valueOf(fPSHFlag)) .put("RST Flag", String.valueOf(fRSTFlag)) .put("SYN Flag", String.valueOf(fSYNFlag)) .put("FIN Flag", String.valueOf(fFINFlag)) .put("Window Size Value", String.valueOf(fWindowSize)) .put("Checksum", String.format("%s%04x", "0x", fChecksum)) .put("Urgent Pointer", String.format("%s%04x", "0x", fUrgentPointer)); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } <START> fFields = NonNullUtils.checkNotNull(builder.build()); <END> return fFields; } return map; }</code><technical_language>check</technical_language>

Target:
public Map<String, String> getFields() { Map<String, String> map = fFields; if (map == null) { Builder<String, String> builder = ImmutableMap.<String, String> builder() .put("Source Port", String.valueOf(fSourcePort)) .put("Destination Port", String.valueOf(fDestinationPort)) .put("Sequence Number", String.valueOf(fSequenceNumber)) .put("Acknowledgement Number", String.valueOf(fAcknowledgmentNumber)) .put("Length", String.valueOf(fDataOffset * TCPValues.BLOCK_SIZE) + " bytes") .put("ECN-Nonce Flag", String.valueOf(fNSFlag)) .put("Congestion Window Reduced Flag", String.valueOf(fCWRFlag)) .put("ECN-Echo Flag", String.valueOf(fECEFlag)) .put("Urgent Flag", String.valueOf(fURGFlag)) .put("ACK Flag", String.valueOf(fACKFlag)) .put("PSH Flag", String.valueOf(fPSHFlag)) .put("RST Flag", String.valueOf(fRSTFlag)) .put("SYN Flag", String.valueOf(fSYNFlag)) .put("FIN Flag", String.valueOf(fFINFlag)) .put("Window Size Value", String.valueOf(fWindowSize)) .put("Checksum", String.format("%s%04x", "0x", fChecksum)) .put("Urgent Pointer", String.format("%s%04x", "0x", fUrgentPointer)); byte[] options = fOptions; if (options == null) { builder.put("Options", EMPTY_STRING); } else { builder.put("Options", ConversionHelper.bytesToHex(options, true)); } fFields = checkNotNull(builder.build()); return fFields; } return map; }
Source:
<code>public CruelDeceiverEffect() { super(Outcome.AddAbility); <START> this.staticText = "Reveal the top card of your library. If it's a land card, Cruel Deceiver gains \"Whenever Cruel Deceiver deals damage to a creature, destroy that creature\" until end of turn"; <END> }</code><technical_language>Instead of Cruel Deceiver add {this}</technical_language>

Target:
public CruelDeceiverEffect() { super(Outcome.AddAbility); this.staticText = "Reveal the top card of your library. If it's a land card, {this} gains \"Whenever Cruel Deceiver deals damage to a creature, destroy that creature\" until end of turn"; }
Source:
<code>public String toString() { <START> return SpongeCatalogType.toStringHelperTranslatable(this) <END> .toString(); }</code><technical_language>Lazy load this a field</technical_language>

Target:
public String toString() { if (this.toString == null) { this.toString = SpongeCatalogType.toStringHelperTranslatable(this) .toString(); } return this.toString; }
Source:
<code>public Request<TransactionContext, String> toCreateRequest(String containerId) { <START> return SnomedRequests.prepareNewMember() <END> .setReferencedComponentId(containerId) .setReferenceSetId(getReferenceSetId()) .setModuleId(getModuleId()) .setProperties(getProperties()) .build(); }</code><technical_language>Are/should toCreateRequest toUpdateRequest chained in some way? I if a of changing a reference set member status here</technical_language>

Target:
public Request<TransactionContext, String> toCreateRequest(String containerId) { return SnomedRequests.prepareNewMember() .setActive(isActive()) .setReferencedComponentId(containerId) .setReferenceSetId(getReferenceSetId()) .setModuleId(getModuleId()) .setProperties(getProperties()) .build(); }
Source:
<code>public SimpleNodeSelector( InternalNodeManager nodeManager, NodeSelectionStats nodeSelectionStats, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, int maxSplitsPerNode, int maxPendingSplitsPerTask, int maxTasksPerStage) { this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); <START> this.nodeSelectionStats = requireNonNull(nodeSelectionStats, "NodeSelectionStats is null"); <END> this.nodeTaskMap = requireNonNull(nodeTaskMap, "nodeTaskMap is null"); this.includeCoordinator = includeCoordinator; this.nodeMap = new AtomicReference<>(nodeMap); this.minCandidates = minCandidates; this.maxSplitsPerNode = maxSplitsPerNode; this.maxPendingSplitsPerTask = maxPendingSplitsPerTask; this.maxTasksPerStage = maxTasksPerStage; }</code><technical_language>"nodeSelectionStats is null"</technical_language>

Target:
public SimpleNodeSelector( InternalNodeManager nodeManager, NodeSelectionStats nodeSelectionStats, NodeTaskMap nodeTaskMap, boolean includeCoordinator, Supplier<NodeMap> nodeMap, int minCandidates, int maxSplitsPerNode, int maxPendingSplitsPerTask, int maxTasksPerStage) { this.nodeManager = requireNonNull(nodeManager, "nodeManager is null"); this.nodeSelectionStats = requireNonNull(nodeSelectionStats, "nodeSelectionStats is null"); this.nodeTaskMap = requireNonNull(nodeTaskMap, "nodeTaskMap is null"); this.includeCoordinator = includeCoordinator; this.nodeMap = new AtomicReference<>(nodeMap); this.minCandidates = minCandidates; this.maxSplitsPerNode = maxSplitsPerNode; this.maxPendingSplitsPerTask = maxPendingSplitsPerTask; this.maxTasksPerStage = maxTasksPerStage; }
Source:
<code>public StatsAndCosts( @JsonProperty("stats") Map<PlanNodeId, PlanNodeStatsEstimate> stats, @JsonProperty("costs") Map<PlanNodeId, PlanNodeCostEstimate> costs) { <START> this.stats = requireNonNull(stats, "stats is null"); <END> this.costs = requireNonNull(costs, "costs is null"); }</code><technical_language>ImmutableMap.copyOf()</technical_language>

Target:
public StatsAndCosts( @JsonProperty("stats") Map<PlanNodeId, PlanNodeStatsEstimate> stats, @JsonProperty("costs") Map<PlanNodeId, PlanNodeCostEstimate> costs) { this.stats = ImmutableMap.copyOf(requireNonNull(stats, "stats is null")); this.costs = ImmutableMap.copyOf(requireNonNull(costs, "costs is null")); }
Source:
<code>protected String createFile(int wordCount) throws IOException { File tempFile = testFolder.newFile("file.txt"); try (FileWriter fw = new FileWriter(tempFile, true)) { <START> BufferedWriter bw = new BufferedWriter(fw); <END> for (int i = 0; i < wordCount; i++) { bw.write(" word" + i); if (rand.nextInt(10) == 1) { bw.newLine(); } } bw.close(); } return tempFile.getAbsolutePath(); }</code><technical_language>new BufferedWriter try avoid final close()</technical_language>

Target:
protected String createFile(int wordCount) throws IOException { File tempFile = testFolder.newFile("file.txt"); try (FileWriter fw = new FileWriter(tempFile, true); BufferedWriter bw = new BufferedWriter(fw)) { for (int i = 0; i < wordCount; i++) { bw.write(" word" + i); if (RANDOM.nextInt(10) == 1) { bw.newLine(); } } } return tempFile.getAbsolutePath(); }
Source:
<code>private void handleRemovedDevices(Guid vmId, HashSet<Guid> processedDevices, List<VmDevice> devices) { for (VmDevice device : devices) { if (!processedDevices.contains(device.getDeviceId())) { if (device.getIsManaged()) { if (!device.getIsPlugged()) { <START> log.errorFormat("VM {0} managed non pluggable device was removed unexpetedly from libvirt: {1}", <END> vmId, device.toString()); } else { device.setAddress(""); addVmDeviceToList(device); log.debugFormat("VM {0} managed pluggable device was unplugged : {1}", vmId, device.toString()); } } else { removedDeviceIds.add(device.getId()); log.debugFormat("VM {0} unmanaged device was marked for remove : {1}", vmId, device.toString()); } } } }</code><technical_language>s/unexpetedly/unexpectedly</technical_language>

Target:
private void handleRemovedDevices(Guid vmId, HashSet<Guid> processedDevices, List<VmDevice> devices) { for (VmDevice device : devices) { if (!processedDevices.contains(device.getDeviceId())) { if (device.getIsManaged()) { if (!device.getIsPlugged()) { log.errorFormat("VM {0} managed non pluggable device was removed unexpectedly from libvirt: {1}", vmId, device.toString()); } else { device.setAddress(""); addVmDeviceToList(device); log.debugFormat("VM {0} managed pluggable device was unplugged : {1}", vmId, device.toString()); } } else { removedDeviceIds.add(device.getId()); log.debugFormat("VM {0} unmanaged device was marked for remove : {1}", vmId, device.toString()); } } } }
Source:
<code>protected void setUp() throws Exception { super.setUp(); Statement stmt = con.createStatement(); TestUtil.createTable(con, "testtz", "col1 INTEGER, col2 TIMESTAMP"); stmt.close(); <START> con.setAutoCommit(false); <END> }</code><technical_language>Please remove</technical_language>

Target:
protected void setUp() throws Exception { super.setUp(); Statement stmt = con.createStatement(); TestUtil.createTable(con, "testtz", "col1 INTEGER, col2 TIMESTAMP"); stmt.close(); }
Source:
<code>public void shouldCallSendTemplateMethod() throws IOException, SAXException, ParserConfigurationException, ClassNotFoundException { Map<String, Object> params = new HashMap<>(); params.put(Constants.TEMPLATE_NAME_PARAM, "sampleTemplate3"); params.put(Constants.RECIPIENT_NAME_PARAM, "sampleRecipient3"); byte[] bytes = IOUtils.toByteArray(getClass().getResourceAsStream("/empty_template.xml")); Byte[] byteObjects = new Byte[bytes.length]; int i = 0; for (byte b : bytes) { byteObjects[i++] = b; } when(iheTemplateDataService.findByName("sampleTemplate3")).thenReturn(cdaTemplate); when(hl7RecipientsService.getRecipientbyName("sampleRecipient3")).thenReturn(hl7Recipient); when((Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, "templateData")).thenReturn(byteObjects); iheActionHelper.handleAction(params); <START> } <END></code><technical_language>verify() clause verify if method called proper parameters</technical_language>

Target:
public void shouldCallSendTemplateMethod() throws IOException, SAXException, ParserConfigurationException, ClassNotFoundException { Map<String, Object> params = new HashMap<>(); params.put(Constants.TEMPLATE_NAME_PARAM, "sampleTemplate3"); params.put(Constants.RECIPIENT_NAME_PARAM, "sampleRecipient3"); byte[] bytes; try (InputStream inputStream = getClass().getResourceAsStream("/empty_template.xml")) { bytes = IOUtils.toByteArray(inputStream); } Byte[] byteObjects = ArrayUtils.toObject(bytes); when(iheTemplateDataService.findByName("sampleTemplate3")).thenReturn(cdaTemplate); when(hl7RecipientsService.getRecipientbyName("sampleRecipient3")).thenReturn(hl7Recipient); when((Byte[]) iheTemplateDataService.getDetachedField(cdaTemplate, "templateData")).thenReturn(byteObjects); iheActionHelper.handleAction(params); verify(iheTemplateService).sendTemplateToRecipientUrl(hl7Recipient.getRecipientUrl(), new String(bytes, StandardCharsets.UTF_8)); }
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Offset other = (Offset) o; <START> return name.equals(other.name) && offset == other.offset; <END> }</code><technical_language>this class implements Comparable, I prefer making of compareTo() this point in order ensure a.equals(b) <=> a.compareTo(b) == 0</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Offset other = (Offset) o; return compareTo(other) == 0; }
Source:
<code>public void updateQtyBatchs(final I_PP_Order order, final boolean override) { BigDecimal qtyBatchSize = order.getQtyBatchSize(); if (qtyBatchSize.signum() == 0 || override) { final int AD_Workflow_ID = order.getAD_Workflow_ID(); if (AD_Workflow_ID <= 0) { return; } <START> final I_AD_Workflow wf = order.getAD_Workflow(); <END> qtyBatchSize = wf.getQtyBatchSize().setScale(0, RoundingMode.UP); } final BigDecimal qtyBatchs; if (qtyBatchSize.signum() == 0) { qtyBatchs = BigDecimal.ONE; } else { final BigDecimal qtyOrdered = order.getQtyOrdered(); qtyBatchs = qtyOrdered.divide(qtyBatchSize, 0, BigDecimal.ROUND_UP); } order.setQtyBatchs(qtyBatchs); }</code><technical_language>removing this line</technical_language>

Target:
public void updateQtyBatchs(final I_PP_Order order, final boolean override) { BigDecimal qtyBatchSize = order.getQtyBatchSize(); if (qtyBatchSize.signum() == 0 || override) { final int AD_Workflow_ID = order.getAD_Workflow_ID(); if (AD_Workflow_ID <= 0) { return; } final I_AD_Workflow wf = order.getAD_Workflow(); qtyBatchSize = wf.getQtyBatchSize().setScale(0, RoundingMode.UP); order.setQtyBatchSize(qtyBatchSize); } final BigDecimal qtyBatchs; if (qtyBatchSize.signum() == 0) { qtyBatchs = BigDecimal.ONE; } else { final BigDecimal qtyOrdered = order.getQtyOrdered(); qtyBatchs = qtyOrdered.divide(qtyBatchSize, 0, BigDecimal.ROUND_UP); } order.setQtyBatchs(qtyBatchs); }
Source:
<code>public static boolean isFieldObjectType(String fieldName){ <START> if(fieldName == null){ <END> return false; } return OBJECTTYPE_FIELD.equalsIgnoreCase(fieldName); }</code><technical_language>need for null check</technical_language>

Target:
public static boolean isFieldObjectType(String fieldName){ return OBJECTTYPE_FIELD.equalsIgnoreCase(fieldName); }
Source:
<code>private void loadClasses() throws ClassNotFoundException { List<String> classNames = clientUserCodeDeploymentConfig.getClassNames(); List<Class<?>> classes = new ArrayList<Class<?>>(classNames.size()); for (String className : classNames) { classes.add(configClassLoader.loadClass(className)); } <START> List<Class> sortedClasses = sortByInheritance(classes); <END> for (Class clazz : sortedClasses) { String className = clazz.getName(); String resource = className.replace('.', '/').concat(".class"); InputStream is = null; try { is = configClassLoader.getResourceAsStream(resource); if (is == null) { throw new ClassNotFoundException(resource); } byte[] bytes = toByteArray(is); classDefinitionList.add(new AbstractMap.SimpleEntry<String, byte[]>(className, bytes)); } catch (IOException e) { ignore(e); } finally { closeResource(is); } } }</code><technical_language>this do same? Collections.sort(classes, (c1, c2) -> c1.equals(c2) ? 0 : c1.isAssignableFrom(c2) ? -1 : 1);</technical_language>

Target:
private void loadClasses() throws ClassNotFoundException { for (String className : clientUserCodeDeploymentConfig.getClassNames()) { String resource = className.replace('.', '/').concat(".class"); InputStream is = null; try { is = configClassLoader.getResourceAsStream(resource); if (is == null) { throw new ClassNotFoundException(resource); } byte[] bytes = toByteArray(is); classDefinitionList.add(new AbstractMap.SimpleEntry<String, byte[]>(className, bytes)); } catch (IOException e) { ignore(e); } finally { closeResource(is); } } }
Source:
<code>public void pageSummary(final String title, final PageSummary.Callback cb) { Call<RbPageSummary> call = webService.pageSummary(title); call.enqueue(new Callback<RbPageSummary>() { @Override public void onResponse(Call<RbPageSummary> call, Response<RbPageSummary> response) { if (response.isSuccessful()) { responseHeaderHandler.onHeaderCheck(response); if (response.body() == null) { <START> cb.failure(new JsonParseException("Response missing required field(s)")); <END> } cb.success(response.body()); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<RbPageSummary> call, Throwable t) { RbSwitch.INSTANCE.onRbRequestFailed(t); cb.failure(t); } }); }</code><technical_language>I need return something. If possible, tests exercise this case</technical_language>

Target:
public void pageSummary(final String title, final PageSummary.Callback cb) { Call<RbPageSummary> call = webService.pageSummary(title); call.enqueue(new Callback<RbPageSummary>() { @Override public void onResponse(Call<RbPageSummary> call, Response<RbPageSummary> response) { if (response.isSuccessful()) { responseHeaderHandler.onHeaderCheck(response); if (response.body() == null) { cb.failure(new JsonParseException("Response missing required field(s)")); return; } cb.success(response.body()); } else { Throwable throwable = RetrofitException.httpError(response, retrofit); RbSwitch.INSTANCE.onRbRequestFailed(throwable); cb.failure(throwable); } } @Override public void onFailure(Call<RbPageSummary> call, Throwable t) { RbSwitch.INSTANCE.onRbRequestFailed(t); cb.failure(t); } }); }