auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void addEditPart(EditPart part, int level, StringBuilder out) { out.append(part.getClass().getSimpleName()); Object model = part.getModel(); if (model instanceof Node) { out.append(": "); Node node = (Node) model; EObject element = node.getElement(); if (element instanceof DDiagramElement) { DDiagramElement diagramElement = (DDiagramElement) element; <START> addDDiagramElement(diagramElement, <END> level, out); } else { out.append(element.getClass().getSimpleName()); } } else { out.append(": "); out.append(model.getClass().getSimpleName()); } }</code><technical_language>show ddiagram element information for name edit part for compartment</technical_language>

Target:
private void addEditPart(EditPart part, int level, StringBuilder out) { out.append(part.getClass().getSimpleName()); Object model = part.getModel(); if (model instanceof Node) { if (!(part instanceof LabelEditPart || part instanceof ListCompartmentEditPart)) { out.append(": "); Node node = (Node) model; EObject element = node.getElement(); if (element instanceof DDiagramElement) { DDiagramElement diagramElement = (DDiagramElement) element; addDDiagramElement(diagramElement, level, out); } else { out.append(element.getClass().getSimpleName()); } } } else { out.append(": "); out.append(model.getClass().getSimpleName()); } }
Source:
<code>public Object apply(Object req) { if (!(req instanceof List)) { return JsonRpc.invalidParams("parameters not a list", req); } List params = (List) req; if (params.size() != 1) { return JsonRpc.invalidParams("must pass exactly 1 parameter", params); } Object param = params.get(0); if (!(param instanceof String)) { return JsonRpc.invalidParams("parameter not a string", param); } CqlRequest cqlRequest; try { cqlRequest = GSON.fromJson((String) param, CqlRequest.class); } catch (RuntimeException e) { return JsonRpc.invalidParams("parameter not valid json", param); } try { return util.executeCqlQuery(cqlRequest); } catch (OauthPluginException e) { if (e.getErrorType() == OauthPluginException.ErrorType.NO_AUTH) { <START> Map<String, String> responseMap = new HashMap<>(); <END> responseMap.put("id", e.getSourceId()); responseMap.put("url", e.getRedirectUrl()); return JsonRpc.error(401, GSON.toJson(responseMap)); } else { Map<String, String> responseMap = new HashMap<>(); responseMap.put("id", e.getSourceId()); return JsonRpc.error(412, GSON.toJson(responseMap)); } } catch (UnsupportedQueryException e) { LOGGER.error(QUERY_ENDPOINT_FAILED, e); return JsonRpc.error(400, "Unsupported query request."); } catch (RuntimeException e) { LOGGER.debug("Exception occurred", e); return JsonRpc.error(404, "Could not find what you were looking for"); } catch (Exception e) { LOGGER.error(QUERY_ENDPOINT_FAILED, e); return JsonRpc.error(500, "Error while processing query request."); } }</code><technical_language>define this L209 reuse</technical_language>

Target:
public Object apply(Object req) { if (!(req instanceof List)) { return JsonRpc.invalidParams("parameters not a list", req); } List params = (List) req; if (params.size() != 1) { return JsonRpc.invalidParams("must pass exactly 1 parameter", params); } Object param = params.get(0); if (!(param instanceof String)) { return JsonRpc.invalidParams("parameter not a string", param); } CqlRequest cqlRequest; try { cqlRequest = GSON.fromJson((String) param, CqlRequest.class); } catch (RuntimeException e) { return JsonRpc.invalidParams("parameter not valid json", param); } try { return util.executeCqlQuery(cqlRequest); } catch (OauthPluginException e) { Map<String, String> responseMap = ImmutableMap.of(ID_KEY, e.getSourceId(), URL_KEY, e.getProviderUrl()); return JsonRpc.error(HttpStatus.SC_UNAUTHORIZED, GSON.toJson(responseMap)); } catch (UnsupportedQueryException e) { LOGGER.error(QUERY_ENDPOINT_FAILED, e); return JsonRpc.error(400, "Unsupported query request."); } catch (RuntimeException e) { LOGGER.debug("Exception occurred", e); return JsonRpc.error(404, "Could not find what you were looking for"); } catch (Exception e) { LOGGER.error(QUERY_ENDPOINT_FAILED, e); return JsonRpc.error(500, "Error while processing query request."); } }
Source:
<code><START> private String[] getTo() throws JobEmailNotificationException { <END> String to = jobState.getGenericInformation().get(GENERIC_INFORMATION_KEY_EMAIL); if (to == null) { throw new JobEmailNotificationException("Recipient address is not set in generic information"); } String[] toList = to.split("\\s*,\\s*"); return toList; }</code><technical_language>array a List</technical_language>

Target:
private List<String> getTo() throws JobEmailNotificationException { String to = jobState.getGenericInformation().get(GENERIC_INFORMATION_KEY_EMAIL); if (to == null) { throw new JobEmailNotificationException("Recipient address is not set in generic information"); } String[] toList = to.split("\\s*,\\s*"); return Arrays.asList(toList); }
Source:
<code>public List<DataSetProperty> processDatasetProperties(Integer datasetId, Date now, List<DataSetPropertyDTO> properties) { List<Dictionary> dictionaries = dataSetDAO.getMappedFieldsOrderByReceiveOrder(); <START> dictionaries.remove(0); <END> return properties.stream() .map( p -> { Dictionary dictionary = dictionaries.stream() .filter(d -> d.getKey().equals(p.getPropertyName())) .findAny() .orElse(null); return new DataSetProperty(datasetId, dictionary.getKeyId(), p.getPropertyValue(), now); } ).collect(Collectors.toList()); }</code><technical_language>This fail if receive order changes. for actual property want instead of guessing position in array</technical_language>

Target:
public List<DataSetProperty> processDatasetProperties(Integer datasetId, Date now, List<DataSetPropertyDTO> properties) { List<Dictionary> dictionaries = dataSetDAO.getMappedFieldsOrderByReceiveOrder(); return properties.stream() .filter(p -> !p.getPropertyName().equals("Dataset Name")) .map( p -> { Dictionary dictionary = dictionaries.stream() .filter(d -> d.getKey().equals(p.getPropertyName())) .findFirst().get(); return new DataSetProperty(datasetId, dictionary.getKeyId(), p.getPropertyValue(), now); } ).collect(Collectors.toList()); }
Source:
<code><START> List<RebalanceOperationPerformer.MemberPRInfo> getMembersForEachRegion(InternalCache cache, <END> List<String> excludedRegionList) { return RebalanceOperationPerformer.getMemberRegionList( ManagementService.getManagementService(cache), cache, excludedRegionList); }</code><technical_language>getMembersForEachRegion private need @VisibleForTesting. Currently test method though</technical_language>

Target:
private List<RebalanceOperationPerformer.MemberPRInfo> getMembersForEachRegion( InternalCache cache, List<String> excludedRegionList) { return RebalanceOperationPerformer.getMemberRegionList( ManagementService.getManagementService(cache), cache, excludedRegionList); }
Source:
<code>private AbstractTaskReference adaptFromRevCommit(RevCommit commit) { Repository[] repositories = Activator.getDefault().getRepositoryCache().getAllRepositories(); for (Repository r : repositories) { RevWalk revWalk = new RevWalk(r); String repoUrl = null; String message = null; try { RevCommit revCommit = revWalk.parseCommit(commit); if (revCommit != null) { repoUrl = getRepoUrl(r); message = revCommit.getFullMessage(); } } catch (Exception e) { continue; } <START> if (message == null || message.trim().length() == 0) { <END> continue; } String taskRepositoryUrl = null; if (repoUrl != null) { TaskRepository repository = getTaskRepositoryByGitRepoURL(repoUrl); if (repository != null) { taskRepositoryUrl = repository.getRepositoryUrl(); } } return new LinkedTaskInfo(taskRepositoryUrl, null, null, message); } return null; }</code><technical_language>style nit: braces</technical_language>

Target:
private AbstractTaskReference adaptFromRevCommit(RevCommit commit) { Repository[] repositories = Activator.getDefault().getRepositoryCache().getAllRepositories(); for (Repository r : repositories) { RevWalk revWalk = new RevWalk(r); String repoUrl = null; String message = null; try { RevCommit revCommit = revWalk.parseCommit(commit); if (revCommit != null) { repoUrl = getRepoUrl(r); message = revCommit.getFullMessage(); } } catch (Exception e) { continue; } if (message == null || message.trim().length() == 0) continue; String taskRepositoryUrl = null; if (repoUrl != null) { TaskRepository repository = getTaskRepositoryByGitRepoURL(repoUrl); if (repository != null) taskRepositoryUrl = repository.getRepositoryUrl(); } return new LinkedTaskInfo(taskRepositoryUrl, null, null, message); } return null; }
Source:
<code><START> public void testStateAdvancedChange_undeployFails() throws InterruptedException { <END> this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void undeploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); }</code><technical_language>No, this method throw interrupted exceptions</technical_language>

Target:
public void testStateAdvancedChange_undeployFails() { this.agent.stop(); this.agent = new Agent() { @Override public PluginInterface findPlugin( Instance instance ) { return new PluginMock() { @Override public void undeploy( Instance instance ) throws PluginException { throw new PluginException( "For tests..." ); } }; } }; this.agent.setMessagingType(MessagingConstants.FACTORY_TEST); this.agent.start(); AgentMessageProcessor processor = (AgentMessageProcessor) this.agent.getMessagingClient().getMessageProcessor(); TestApplicationTemplate app = new TestApplicationTemplate(); processor.processMessage( new MsgCmdSetScopedInstance( app.getTomcatVm())); Assert.assertEquals( app.getTomcatVm(), processor.scopedInstance ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, processor.scopedInstance.getStatus()); Assert.assertEquals( InstanceStatus.NOT_DEPLOYED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STARTED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.DEPLOYED_STOPPED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); processor.processMessage( new MsgCmdChangeInstanceState( app.getTomcat(), InstanceStatus.NOT_DEPLOYED )); Assert.assertEquals( InstanceStatus.DEPLOYED_STOPPED, app.getTomcat().getStatus()); }
Source:
<code>private String parseMode(String value) { if (value.equals("AUTO")) return "Auto"; if (value.equals("DRY")) return "Dry"; if (value.equals("COOL")) return "Cool"; if (value.equals("HEAT")) return "Heat"; if (value.equals("ONLYFUN")) return "OnlyFun"; <START> if (value.equals("NIGHT")) return "Night"; <END> return "None"; }</code><technical_language>please refactor Enumerations instead</technical_language>

Target:
private DaikinMode parseMode(String value) { if (value.equals("AUTO")) return DaikinMode.Auto; if (value.equals("DRY")) return DaikinMode.Dry; if (value.equals("COOL")) return DaikinMode.Cool; if (value.equals("HEAT")) return DaikinMode.Heat; if (value.equals("ONLYFUN")) return DaikinMode.OnlyFun; if (value.equals("NIGHT")) return DaikinMode.Night; return DaikinMode.None; }
Source:
<code>private Object convert(Object payload, Collection<MediaType> to) { if (this.conversionService != null) { MediaType requiredMediaType = findJavaObjectType(to); if (requiredMediaType != null) { String requiredType = requiredMediaType.getParameter("type"); if (requiredType == null) { return payload; } Class<?> clazz = null; try { <START> clazz = Class.forName(requiredType); <END> } catch (ClassNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug("Class not found", e); } } if (clazz != null) { if (this.conversionService.canConvert(payload.getClass(), clazz)) { return this.conversionService.convert(payload, clazz); } } } else { if (this.acceptsString(to)) { if (this.conversionService.canConvert(payload.getClass(), String.class)) { return this.conversionService.convert(payload, String.class); } } } } return null; }</code><technical_language>this class BeanClassLoaderAware provided classloader instead of direct Class.forName(..) call</technical_language>

Target:
private Object convert(Object payload, Collection<MediaType> to) { if (this.conversionService != null) { MediaType requiredMediaType = findJavaObjectType(to); if (requiredMediaType != null) { String requiredType = requiredMediaType.getParameter("type"); if (requiredType == null) { return payload; } Class<?> clazz = null; try { clazz = this.beanClassloader.loadClass(requiredType); } catch (ClassNotFoundException e) { if (logger.isDebugEnabled()) { logger.debug("Class not found", e); } } if (clazz != null) { if (this.conversionService.canConvert(payload.getClass(), clazz)) { return this.conversionService.convert(payload, clazz); } } } else { if (this.acceptsString(to)) { if (this.conversionService.canConvert(payload.getClass(), String.class)) { return this.conversionService.convert(payload, String.class); } } } } return null; }
Source:
<code><START> boolean isValidMetaKey(int key) { <END> if (key == BluetoothDevice.METADATA_MANUFACTURER_NAME || key == BluetoothDevice.METADATA_MODEL_NAME || key == BluetoothDevice.METADATA_SOFTWARE_VERSION || key == BluetoothDevice.METADATA_HARDWARE_VERSION || key == BluetoothDevice.METADATA_COMPANION_APP || key == BluetoothDevice.METADATA_MAIN_ICON || key == BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET || key == BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON || key == BluetoothDevice.METADATA_UNTHETHERED_RIGHT_ICON || key == BluetoothDevice.METADATA_UNTHETHERED_CASE_ICON || key == BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY || key == BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY || key == BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY || key == BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI) { return true; } return false; }</code><technical_language>switch case more efficient: switch (key): case VALID1: case VALID2: return true; default: return false;</technical_language>

Target:
boolean isValidMetaKey(int key) { switch (key) { case BluetoothDevice.METADATA_MANUFACTURER_NAME: case BluetoothDevice.METADATA_MODEL_NAME: case BluetoothDevice.METADATA_SOFTWARE_VERSION: case BluetoothDevice.METADATA_HARDWARE_VERSION: case BluetoothDevice.METADATA_COMPANION_APP: case BluetoothDevice.METADATA_MAIN_ICON: case BluetoothDevice.METADATA_IS_UNTHETHERED_HEADSET: case BluetoothDevice.METADATA_UNTHETHERED_LEFT_ICON: case BluetoothDevice.METADATA_UNTHETHERED_RIGHT_ICON: case BluetoothDevice.METADATA_UNTHETHERED_CASE_ICON: case BluetoothDevice.METADATA_UNTHETHERED_LEFT_BATTERY: case BluetoothDevice.METADATA_UNTHETHERED_RIGHT_BATTERY: case BluetoothDevice.METADATA_UNTHETHERED_CASE_BATTERY: case BluetoothDevice.METADATA_ENHANCED_SETTINGS_UI_URI: return true; } Log.w(TAG, "Invalid metadata key " + key); return false; }
Source:
<code>public String getHelpText() { <START> return new String(); <END> }</code><technical_language>instead return ""; avoid creating new objects everytime method is called, "" refer object (string literals get internalized). a private static final String EMTPY_STRING = ""; in class instead, if a lot of in file</technical_language>

Target:
public String getHelpText() { return ""; }
Source:
<code>private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); String branchNameMessage = null; if (branchName.length() == 0) { branchNameMessage = MessageFormat.format( UIText.PullWizardPage_ChooseReference, remoteConfig.getName()); } else if (!Repository .isValidRefName(Constants.R_HEADS + branchName)) { <START> branchNameMessage = UIText.PushBranchPage_InvalidBranchNameError; <END> return; } if (branchNameMessage != null) { setErrorMessage(branchNameMessage); if (this.missingBranchDecorator == null) { this.missingBranchDecorator = new ControlDecoration(this.remoteBranchNameText, SWT.TOP | SWT.LEFT); this.missingBranchDecorator .setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_ERROR) .getImage()); } this.missingBranchDecorator .setDescriptionText(branchNameMessage); this.missingBranchDecorator.show(); return; } else if (this.missingBranchDecorator != null) { this.missingBranchDecorator.hide(); } if (overrideUpstreamConfiguration() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PullWizardPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }</code><technical_language>Dead store. want allow pulling non-advertised refs, this if-branch removed</technical_language>

Target:
private void checkPage() { try { if (remoteConfig == null) { setErrorMessage(UIText.PushBranchPage_ChooseRemoteError); return; } String branchName = remoteBranchNameText.getText(); String branchNameMessage = null; if (branchName.length() == 0) { branchNameMessage = MessageFormat.format( UIText.PullWizardPage_ChooseReference, remoteConfig.getName()); } if (branchNameMessage != null) { setErrorMessage(branchNameMessage); if (this.missingBranchDecorator == null) { this.missingBranchDecorator = new ControlDecoration(this.remoteBranchNameText, SWT.TOP | SWT.LEFT); this.missingBranchDecorator .setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration( FieldDecorationRegistry.DEC_ERROR) .getImage()); } this.missingBranchDecorator .setDescriptionText(branchNameMessage); this.missingBranchDecorator.show(); return; } else if (this.missingBranchDecorator != null) { this.missingBranchDecorator.hide(); } if (overrideUpstreamConfiguration() && hasDifferentUpstreamConfiguration()) { setMessage(UIText.PushBranchPage_UpstreamConfigOverwriteWarning, IMessageProvider.WARNING); } else { setMessage(UIText.PullWizardPage_PageMessage); } setErrorMessage(null); } finally { setPageComplete(getErrorMessage() == null); } }
Source:
<code>public void testDeviceConversion() throws UnknownHostException { final Device device = new Device("id", "alias", "city", "postal", "street", "nr", "munic", 12f, 13f); device.updateRegistrationData(InetAddress.getByName("localhost"), "type"); final com.alliander.osgp.adapter.ws.schema.core.devicemanagement.Device jaxbDevice = this.deviceManagementMapper .map(device, com.alliander.osgp.adapter.ws.schema.core.devicemanagement.Device.class); Assert.assertEquals("id", jaxbDevice.getDeviceIdentification()); <START> Assert.assertEquals("alias", jaxbDevice.getAlias()); <END> Assert.assertEquals("city", jaxbDevice.getContainerCity()); Assert.assertEquals("postal", jaxbDevice.getContainerPostalCode()); Assert.assertEquals("street", jaxbDevice.getContainerStreet()); Assert.assertEquals("nr", jaxbDevice.getContainerNumber()); Assert.assertEquals("munic", jaxbDevice.getContainerMunicipality()); Assert.assertEquals("12.0", jaxbDevice.getGpsLatitude()); Assert.assertEquals("13.0", jaxbDevice.getGpsLongitude()); Assert.assertEquals("localhost/127.0.0.1", jaxbDevice.getNetworkAddress()); Assert.assertEquals("type", jaxbDevice.getDeviceType()); }</code><technical_language>static import</technical_language>

Target:
public void testDeviceConversion() throws UnknownHostException { final Device device = new Device("id", "alias", "city", "postal", "street", "nr", "munic", 12f, 13f); device.updateRegistrationData(InetAddress.getByName("localhost"), "type"); final com.alliander.osgp.adapter.ws.schema.core.devicemanagement.Device jaxbDevice = this.deviceManagementMapper .map(device, com.alliander.osgp.adapter.ws.schema.core.devicemanagement.Device.class); assertEquals("id", jaxbDevice.getDeviceIdentification()); assertEquals("alias", jaxbDevice.getAlias()); assertEquals("city", jaxbDevice.getContainerCity()); assertEquals("postal", jaxbDevice.getContainerPostalCode()); assertEquals("street", jaxbDevice.getContainerStreet()); assertEquals("nr", jaxbDevice.getContainerNumber()); assertEquals("munic", jaxbDevice.getContainerMunicipality()); assertEquals("12.0", jaxbDevice.getGpsLatitude()); assertEquals("13.0", jaxbDevice.getGpsLongitude()); assertEquals("localhost/127.0.0.1", jaxbDevice.getNetworkAddress()); assertEquals("type", jaxbDevice.getDeviceType()); }
Source:
<code>ProcedureRunner(VoltProcedure procedure, SiteProcedureConnection site, SystemProcedureExecutionContext sysprocContext, Procedure catProc, CatalogSpecificPlanner csp) { assert(m_inputCRC.getValue() == 0L); String language = catProc.getLanguage(); if (language != null && !language.trim().isEmpty()) { m_language = Language.valueOf(language.trim().toUpperCase()); } else if (procedure instanceof StmtProcedure){ m_language = null; } else { m_language = Language.JAVA; } if (procedure instanceof StmtProcedure) { m_procedureName = catProc.getTypeName().intern(); } else { m_procedureName = m_language.accept(procedureNameRetriever, procedure); } m_procedure = procedure; m_isSysProc = procedure instanceof VoltSystemProcedure; m_catProc = catProc; m_hasJava = catProc.getHasjava(); m_isReadOnly = catProc.getReadonly(); m_isSinglePartition = m_catProc.getSinglepartition(); if (m_isSinglePartition) { ProcedurePartitionInfo ppi = (ProcedurePartitionInfo)m_catProc.getAttachment(); m_partitionColumn = ppi.index; m_partitionColumnType = ppi.type; } else { m_partitionColumn = 0; m_partitionColumnType = null; } m_site = site; m_systemProcedureContext = sysprocContext; m_csp = csp; m_procedure.init(this); m_statsCollector = new ProcedureStatsCollector( m_site.getCorrespondingSiteId(), m_site.getCorrespondingPartitionId(), m_catProc); <START> m_statsCollector = VoltDB.instance().getStatsAgent().registerProcedureStatsSource( <END> site.getCorrespondingSiteId(), m_statsCollector); reflect(); }</code><technical_language>combine this line previous line together, assigning m_statsCollector a wired me</technical_language>

Target:
ProcedureRunner(VoltProcedure procedure, SiteProcedureConnection site, SystemProcedureExecutionContext sysprocContext, Procedure catProc, CatalogSpecificPlanner csp) { assert(m_inputCRC.getValue() == 0L); String language = catProc.getLanguage(); if (language != null && !language.trim().isEmpty()) { m_language = Language.valueOf(language.trim().toUpperCase()); } else if (procedure instanceof StmtProcedure){ m_language = null; } else { m_language = Language.JAVA; } if (procedure instanceof StmtProcedure) { m_procedureName = catProc.getTypeName().intern(); } else { m_procedureName = m_language.accept(procedureNameRetriever, procedure); } m_procedure = procedure; m_isSysProc = procedure instanceof VoltSystemProcedure; m_catProc = catProc; m_hasJava = catProc.getHasjava(); m_isReadOnly = catProc.getReadonly(); m_isSinglePartition = m_catProc.getSinglepartition(); if (m_isSinglePartition) { ProcedurePartitionInfo ppi = (ProcedurePartitionInfo)m_catProc.getAttachment(); m_partitionColumn = ppi.index; m_partitionColumnType = ppi.type; } else { m_partitionColumn = 0; m_partitionColumnType = null; } m_site = site; m_systemProcedureContext = sysprocContext; m_csp = csp; m_procedure.init(this); m_statsCollector = VoltDB.instance().getStatsAgent().registerProcedureStatsSource( site.getCorrespondingSiteId(), new ProcedureStatsCollector( m_site.getCorrespondingSiteId(), m_site.getCorrespondingPartitionId(), m_catProc) ); reflect(); }
Source:
<code>boolean excludeMatchBean(Configuration conf) { Filter exclude = conf.getExclude(); ArrayList<String> beanNames = exclude.getBeanNames(); if(beanNames.contains(beanName)){ return true; } for (String bean_attr : exclude.keySet()) { if (EXCLUDED_BEAN_PARAMS.contains(bean_attr)) { continue; } ArrayList<String> beanValues = exclude.getParameterValues(bean_attr); for (String beanVal : beanValues) { <START> if (beanParameters.get(bean_attr) != null && beanParameters.get(bean_attr).equals(beanVal)) { <END> return true; } } } return false; }</code><technical_language>get condition out of loop, test presence of attribute in list</technical_language>

Target:
boolean excludeMatchBean(Configuration conf) { Filter exclude = conf.getExclude(); ArrayList<String> beanNames = exclude.getBeanNames(); if(beanNames.contains(beanName)){ return true; } for (String bean_attr : exclude.keySet()) { if (EXCLUDED_BEAN_PARAMS.contains(bean_attr)) { continue; } if (beanParameters.get(bean_attr) == null) { continue; } ArrayList<String> beanValues = exclude.getParameterValues(bean_attr); for (String beanVal : beanValues) { if (beanParameters.get(bean_attr).equals(beanVal)) { return true; } } } return false; }
Source:
<code>private Map<String, String> createGroups(List<String> groups) { <START> return GroupsHelper.createGroups(groups, m_metaGroups); <END> }</code><technical_language>If reverse parameters order, more createListenerFactory</technical_language>

Target:
private Map<String, String> createGroups(List<String> groups) { return GroupsHelper.createGroups(m_metaGroups, groups); }
Source:
<code>public void verifyPreviewPageHeader(String targetText) { Assertion.assertStringContains(targetText, getPageHeaderText()); <START> PageObjectLogging.log("verifyPreviewPageHeader", <END> "verifying the summary shows " + targetText, true); }</code><technical_language>wrong formatting - parameter in new line</technical_language>

Target:
public void verifyPreviewPageHeader(String targetText) { Assertion.assertStringContains(targetText, selectedPageHeader.getText()); PageObjectLogging.log( "verifyPreviewPageHeader", "The summary shows " + targetText, true ); }
Source:
<code>protected boolean subjectAndCandidateMatch(Item subject, Item candidate) { ImmutableSet<String> aliasesOfCandidateBroadcasts = FluentIterable.from(candidate.flattenBroadcasts()) .transformAndConcat(BROADCAST_TO_ALIAS_STRING_ITERABLE) .toSet(); ImmutableSet<String> aliasesOfSubjectBroadcasts = FluentIterable.from(subject.flattenBroadcasts()) .transformAndConcat(BROADCAST_TO_ALIAS_STRING_ITERABLE) .toSet(); if (!Sets.intersection(aliasesOfCandidateBroadcasts, aliasesOfSubjectBroadcasts).isEmpty()) { return true; } <START> return false; <END> }</code><technical_language>eliminate if here, do: return !Sets.intersection(aliasesOfCandidateBroadcasts, aliasesOfSubjectBroadcasts).isEmpty();</technical_language>

Target:
protected boolean subjectAndCandidateMatch(Item subject, Item candidate) { ImmutableSet<String> aliasesOfCandidateBroadcasts = FluentIterable.from(candidate.flattenBroadcasts()) .transformAndConcat(BROADCAST_TO_ALIAS_STRING_ITERABLE) .toSet(); ImmutableSet<String> aliasesOfSubjectBroadcasts = FluentIterable.from(subject.flattenBroadcasts()) .transformAndConcat(BROADCAST_TO_ALIAS_STRING_ITERABLE) .toSet(); return !Sets.intersection(aliasesOfCandidateBroadcasts, aliasesOfSubjectBroadcasts).isEmpty(); }
Source:
<code>private boolean isColumnEligibleToScale(Column column, List<String> scaleRequestedColumnNames) { return (column.isNumeric() && column.getColumnClass() != ColumnClass.FACTOR <START> && ((scaleRequestedColumnNames == null) || scaleRequestedColumnNames.isEmpty() || scaleRequestedColumnNames.contains(column.getName()))); <END> }</code><technical_language>do want treat empty case "requesting columns"? confusing error-prone</technical_language>

Target:
private boolean isColumnEligibleToScale(Column column, List<String> scaleRequestedColumnNames) { return (column.isNumeric() && column.getColumnClass() != ColumnClass.FACTOR && ((scaleRequestedColumnNames == null) || scaleRequestedColumnNames.contains(column.getName()))); }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RpcOptions options = (RpcOptions) o; if (timeout != options.timeout) return false; if (deliverOrder != options.deliverOrder) return false; <START> return unit == options.unit; <END> }</code><technical_language>nitpick: replace if && suggestion return timeout == options.timeout && deliverOrder == options.deliverOrder && unit == options.unit;</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; RpcOptions options = (RpcOptions) o; return timeout == options.timeout && deliverOrder == options.deliverOrder && unit == options.unit; }
Source:
<code>public byte[] toBytes(TimeSeriesKey<K> timeSeriesKey) { K key = timeSeriesKey.getKey(); long timestamp = timeSeriesKey.getTimestamp(); int seqNum = timeSeriesKey.getSeqNum(); byte[] serializedKey = keySerde.toBytes(key); <START> int keySize = serializedKey == null ? 0 : serializedKey.length; <END> ByteBuffer buf = ByteBuffer.allocate(keySize + TIMESTAMP_SIZE + SEQNUM_SIZE); if (serializedKey != null) { buf.put(serializedKey); } buf.putLong(timestamp); buf.putInt(seqNum); return buf.array(); }</code><technical_language>do allow null key bytes? cases timestamp + seq is sufficient</technical_language>

Target:
public byte[] toBytes(TimeSeriesKey<K> timeSeriesKey) { K key = timeSeriesKey.getKey(); long timestamp = timeSeriesKey.getTimestamp(); long seqNum = timeSeriesKey.getSeqNum(); byte[] serializedKey = keySerde.toBytes(key); int keySize = serializedKey == null ? 0 : serializedKey.length; ByteBuffer buf = ByteBuffer.allocate(keySize + TIMESTAMP_SIZE + SEQNUM_SIZE); if (serializedKey != null) { buf.put(serializedKey); } buf.putLong(timestamp); buf.putLong(seqNum & SEQUENCE_NUM_MASK); return buf.array(); }
Source:
<code>public void shouldProvidePopulatorThatEnforcesUniqueConstraints() throws Exception { String value = "value1"; int nodeId1 = 1; int nodeId2 = 2; IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() ); IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig ); populator.create(); populator.add( Arrays.asList( IndexEntryUpdate.add( nodeId1, descriptor, value ), IndexEntryUpdate.add( nodeId2, descriptor, value ) ) ); try { PropertyAccessor propertyAccessor = mock( PropertyAccessor.class ); int propertyKeyId = descriptor.schema().getPropertyId(); when( propertyAccessor.getProperty( nodeId1, propertyKeyId )).thenReturn( stringProperty( propertyKeyId, value ) ); when( propertyAccessor.getProperty( nodeId2, propertyKeyId )).thenReturn( stringProperty( propertyKeyId, value ) ); populator.verifyDeferredConstraints( propertyAccessor ); fail( "expected exception" ); } catch ( IndexEntryConflictException conflict ) { assertEquals( nodeId1, conflict.getExistingNodeId() ); <START> assertEquals( new OrderedPropertyValues( value ), conflict.getPropertyValues() ); <END> assertEquals( nodeId2, conflict.getAddedNodeId() ); } }</code><technical_language>super nice set of OrderedPropertyValues.of static factory methods</technical_language>

Target:
public void shouldProvidePopulatorThatEnforcesUniqueConstraints() throws Exception { String value = "value1"; int nodeId1 = 1; int nodeId2 = 2; IndexSamplingConfig indexSamplingConfig = new IndexSamplingConfig( Config.empty() ); IndexPopulator populator = indexProvider.getPopulator( 17, descriptor, indexSamplingConfig ); populator.create(); populator.add( Arrays.asList( IndexEntryUpdate.add( nodeId1, descriptor, value ), IndexEntryUpdate.add( nodeId2, descriptor, value ) ) ); try { PropertyAccessor propertyAccessor = mock( PropertyAccessor.class ); int propertyKeyId = descriptor.schema().getPropertyId(); when( propertyAccessor.getProperty( nodeId1, propertyKeyId )).thenReturn( stringProperty( propertyKeyId, value ) ); when( propertyAccessor.getProperty( nodeId2, propertyKeyId )).thenReturn( stringProperty( propertyKeyId, value ) ); populator.verifyDeferredConstraints( propertyAccessor ); fail( "expected exception" ); } catch ( IndexEntryConflictException conflict ) { assertEquals( nodeId1, conflict.getExistingNodeId() ); assertEquals( OrderedPropertyValues.of( value ), conflict.getPropertyValues() ); assertEquals( nodeId2, conflict.getAddedNodeId() ); } }
Source:
<code>protected ModelAndView uploadReportTemplate(HttpServletRequest request, @RequestParam MultipartFile templateFile) <START> throws IOException, SAXException { <END> if (templateFile.isEmpty()) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "radiology.MrrtReportTemplate.not.imported.empty"); return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); } try { mrrtReportTemplateService.importMrrtReportTemplate(templateFile.getInputStream()); request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.MrrtReportTemplate.imported"); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } catch (APIException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); }</code><technical_language>@ivange94 importing invalid templ? blow up. user do right Info's ;)</technical_language>

Target:
protected ModelAndView uploadReportTemplate(HttpServletRequest request, @RequestParam MultipartFile templateFile) throws IOException { if (templateFile.isEmpty()) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "radiology.MrrtReportTemplate.not.imported.empty"); return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); } try { mrrtReportTemplateService.importMrrtReportTemplate(templateFile.getInputStream()); request.getSession() .setAttribute(WebConstants.OPENMRS_MSG_ATTR, "radiology.MrrtReportTemplate.imported"); } catch (IOException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } catch (APIException exception) { request.getSession() .setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "Failed to import " + templateFile.getOriginalFilename() + " => " + exception.getMessage()); } return new ModelAndView(RADIOLOGY_DASHBOARD_FORM_VIEW); }
Source:
<code>public OrcZstdDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { <START> this.orcDataSourceId = orcDataSourceId; <END> this.maxBufferSize = maxBufferSize; }</code><technical_language>Check for null</technical_language>

Target:
public OrcZstdDecompressor(OrcDataSourceId orcDataSourceId, int maxBufferSize) { this.orcDataSourceId = requireNonNull(orcDataSourceId, "orcDataSourceId is null"); this.maxBufferSize = maxBufferSize; }
Source:
<code>protected ContextBuilder builder(Properties overrides) { MockWebServer defaultServer = regionToServers.get(DEFAULT_REGION); overrides.setProperty(Constants.PROPERTY_MAX_RETRIES, "1"); return ContextBuilder.newBuilder(new AWSEC2ProviderMetadata()) .credentials(ACCESS_KEY, SECRET_KEY) <START> .endpoint("http://" + defaultServer.getHostName() + ":" + defaultServer.getPort()) <END> .overrides(overrides) .modules(modules); }</code><technical_language>curious.. wildcard change for a specific reason? change other files more verbose</technical_language>

Target:
protected ContextBuilder builder(Properties overrides) { MockWebServer defaultServer = regionToServers.get(DEFAULT_REGION); overrides.setProperty(Constants.PROPERTY_MAX_RETRIES, "1"); return ContextBuilder.newBuilder(new AWSEC2ProviderMetadata()) .credentials(ACCESS_KEY, SECRET_KEY) .endpoint(defaultServer.getUrl("").toString()) .overrides(overrides) .modules(modules); }
Source:
<code>protected MessageDigest getMd5Digest(final HttpServletRequest request) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getKey()) != null) { digest.update(request.getAttribute(attribute.getKey()). <START> toString().getBytes(UTF8)); <END> } } return digest; }</code><technical_language>Instead of getBytes(String charsetName) getBytes(Charset charset) while Java 7's StandardCharsets, for example: getBytes(StandardCharsets.UTF_8) This change retroactively applied Java code references "UTF-8" charset string, too</technical_language>

Target:
protected MessageDigest getMd5Digest(final HttpServletRequest request) throws NoSuchAlgorithmException, UnsupportedEncodingException { MessageDigest digest = createMd5Digest(); for (MD5Attributes attribute: MD5Attributes.values()) { if (request.getAttribute(attribute.getKey()) != null) { digest.update(request.getAttribute(attribute.getKey()). toString().getBytes(StandardCharsets.UTF_8)); } } return digest; }
Source:
<code>public static ClientConfiguration of(ServiceConfiguration config) { return ImmutableClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .proxy(createProxySelector(config.proxy())) <START> .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) <END> .maxNumRetries(DEFAULT_MAX_NUM_RETRIES) .build(); }</code><technical_language>woah, flatMap</technical_language>

Target:
public static ClientConfiguration of(ServiceConfiguration config) { return ClientConfiguration.builder() .sslSocketFactory(SslSocketFactories.createSslSocketFactory(config.security())) .trustManager(SslSocketFactories.createX509TrustManager(config.security())) .uris(config.uris()) .connectTimeout(config.connectTimeout().orElse(DEFAULT_CONNECT_TIMEOUT)) .readTimeout(config.readTimeout().orElse(DEFAULT_READ_TIMEOUT)) .writeTimeout(config.writeTimeout().orElse(DEFAULT_WRITE_TIMEOUT)) .enableGcmCipherSuites(config.enableGcmCipherSuites().orElse(DEFAULT_ENABLE_GCM_CIPHERS)) .proxy(createProxySelector(config.proxy())) .proxyCredentials(config.proxy().flatMap(ProxyConfiguration::credentials)) .maxNumRetries(DEFAULT_MAX_NUM_RETRIES) .build(); }
Source:
<code>private void computeContainerStructure() { if (DEBUG_INITIALIZATION) System.out.println("\n*** Computing Container Structure ***\n"); initializeContainerStructure(); if (DEBUG_INITIALIZATION) dumpContainerStructure(); while (!fWorkList2.isEmpty()) { ConstraintVariable2 v= fWorkList2.pop(); List<ITypeConstraint2> usedIn= fTCModel.getUsedIn(v); for (ITypeConstraint2 <START> iTypeConstraint2 : <END> usedIn) { SubTypeConstraint2 stc= (SubTypeConstraint2) iTypeConstraint2; ConstraintVariable2 lhs= stc.getLeft(); ConstraintVariable2 rhs= stc.getRight(); unifyContainerStructure(lhs, rhs); } TypeEquivalenceSet typeEquivalenceSet= v.getTypeEquivalenceSet(); if (typeEquivalenceSet != null) { ConstraintVariable2[] contributingVariables= typeEquivalenceSet.getContributingVariables(); for (int i= 0; i + 1 < contributingVariables.length; i++) { ConstraintVariable2 first= contributingVariables[i]; ConstraintVariable2 second= contributingVariables[i + 1]; unifyContainerStructure(first, second); } } } if (DEBUG_INITIALIZATION) dumpContainerStructure(); }</code><technical_language>rename constraint typeConstraint</technical_language>

Target:
private void computeContainerStructure() { if (DEBUG_INITIALIZATION) System.out.println("\n*** Computing Container Structure ***\n"); initializeContainerStructure(); if (DEBUG_INITIALIZATION) dumpContainerStructure(); while (!fWorkList2.isEmpty()) { ConstraintVariable2 v= fWorkList2.pop(); for (ITypeConstraint2 constraint : fTCModel.getUsedIn(v)) { SubTypeConstraint2 stc= (SubTypeConstraint2) constraint; ConstraintVariable2 lhs= stc.getLeft(); ConstraintVariable2 rhs= stc.getRight(); unifyContainerStructure(lhs, rhs); } TypeEquivalenceSet typeEquivalenceSet= v.getTypeEquivalenceSet(); if (typeEquivalenceSet != null) { ConstraintVariable2[] contributingVariables= typeEquivalenceSet.getContributingVariables(); for (int i= 0; i + 1 < contributingVariables.length; i++) { ConstraintVariable2 first= contributingVariables[i]; ConstraintVariable2 second= contributingVariables[i + 1]; unifyContainerStructure(first, second); } } } if (DEBUG_INITIALIZATION) dumpContainerStructure(); }
Source:
<code>protected void setTestTag(IBuildInfo info, IConfiguration config) { if (!"stub".equals(config.getCommandOptions().getTestTag())) { info.setTestTag(getTestTag(config)); <START> } else if (info.getTestTag() == null || info.getTestTag().isEmpty()) { <END> info.setTestTag("stub"); } else { CLog.w( "Using the test-tag from the build_provider. Consider updating your config to" + " have no alias/namespace in front of test-tag."); } }</code><technical_language>Strings.isNullOrEmpty simplify code</technical_language>

Target:
protected void setTestTag(IBuildInfo info, IConfiguration config) { if (!"stub".equals(config.getCommandOptions().getTestTag())) { info.setTestTag(getTestTag(config)); } else if (Strings.isNullOrEmpty(info.getTestTag())) { info.setTestTag("stub"); } else { CLog.w( "Using the test-tag from the build_provider. Consider updating your config to" + " have no alias/namespace in front of test-tag."); } }
Source:
<code>public void testListAllTargets() { assertEquals("pants.ini file should have no targets", PantsUtil.listAllTargets(pantsIniFilePath), Lists.newArrayList()); assertEquals("made up file path should have no targets", PantsUtil.listAllTargets(nonexistentFilePath), Lists.newArrayList()); try { PantsUtil.listAllTargets(nonexistentBuildFilePath); fail(String.format("%s should have been thrown", PantsException.class)); } catch (PantsException ignored) { } try { PantsUtil.listAllTargets(invalidBuildFilePath); <START> fail(String.format("%s should have been thrown")); <END> } catch (PantsException ignored) { } }</code><technical_language>is a exception caught? is %s for</technical_language>

Target:
public void testListAllTargets() { assertEquals("pants.ini file should have no targets", PantsUtil.listAllTargets(pantsIniFilePath), Lists.newArrayList()); assertEquals("made up non-BUILD file path should have no targets", PantsUtil.listAllTargets(nonexistentFilePath), Lists.newArrayList()); try { PantsUtil.listAllTargets(nonexistentBuildFilePath); fail(String.format("%s should have been thrown", PantsException.class)); } catch (PantsException ignored) { } try { PantsUtil.listAllTargets(invalidBuildFilePath); fail(String.format("%s should have been thrown", PantsException.class)); } catch (PantsException ignored) { } }
Source:
<code>public void onDestroy() { <START> if (mQueue != null && mQueue.size() > 0) { <END> for (MediaModel oneUpload : mQueue) { cancelUpload(oneUpload); } } mDispatcher.unregister(this); AppLog.i(AppLog.T.MEDIA, "Media Upload Service > destroyed"); super.onDestroy(); }</code><technical_language>getUploadQueue() too</technical_language>

Target:
public void onDestroy() { List<MediaModel> queue = getUploadQueue(); for (MediaModel oneUpload : queue) { cancelUpload(oneUpload); } mDispatcher.unregister(this); AppLog.i(AppLog.T.MEDIA, "Media Upload Service > destroyed"); super.onDestroy(); }
Source:
<code>public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; final World world = CommandUtils.getWorld(sender); if (world == null) { return false; } else { <START> if (world.hasStorm()) { <END> world.setThundering(false); world.setStorm(false); } else { world.setThundering(true); world.setStorm(true); } } return true; }</code><technical_language>Replace this if-block with: java world.setThundering(!world.hasStorm()); world.setStorm(!world.hasStorm());</technical_language>

Target:
public boolean execute(CommandSender sender, String label, String[] args) { if (!testPermission(sender)) return false; final World world = CommandUtils.getWorld(sender); if (world == null) { return false; } else { world.setThundering(!world.hasStorm()); world.setStorm(!world.hasStorm()); } return true; }
Source:
<code>protected boolean copyBlob(String key, S3BlobStore sourceBlobStore, String sourceKey, boolean move) <START> throws IOException, AmazonServiceException { END> String sourceBucketName = sourceBlobStore.bucketName; String sourceBucketKey = sourceBlobStore.bucketPrefix + sourceKey; String bucketKey = bucketPrefix + key; long t0 = 0; if (log.isDebugEnabled()) { t0 = System.currentTimeMillis(); log.debug("Copying s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey); } if (getKeyStrategy().useDeDuplication() && exists(bucketKey)) { return true; } logTrace("->", "getObjectMetadata"); ObjectMetadata sourceMetadata = amazonS3.getObjectMetadata(sourceBucketName, sourceBucketKey); long length = sourceMetadata.getContentLength(); logTrace("<-", length + " bytes"); try { copyBlob(sourceBlobStore.config, sourceBucketKey, config, bucketKey, move); if (log.isDebugEnabled()) { long dtms = System.currentTimeMillis() - t0; log.debug("Copied s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey + " in " + dtms + "ms"); } return true; } catch (AmazonServiceException e) { logTrace("<--", "ERROR"); String message = "Direct copy failed from s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey + " (" + length + " bytes)"; log.warn(message + ", falling back to slow copy: " + e.getMessage()); log.debug(message, e); return false; } }</code><technical_language>throws IOException is needed</technical_language>

Target:
protected boolean copyBlob(String key, S3BlobStore sourceBlobStore, String sourceKey, boolean move) throws AmazonServiceException { String sourceBucketName = sourceBlobStore.bucketName; String sourceBucketKey = sourceBlobStore.bucketPrefix + sourceKey; String bucketKey = bucketPrefix + key; long t0 = 0; if (log.isDebugEnabled()) { t0 = System.currentTimeMillis(); log.debug("Copying s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey); } if (getKeyStrategy().useDeDuplication() && exists(bucketKey)) { return true; } logTrace("->", "getObjectMetadata"); ObjectMetadata sourceMetadata = amazonS3.getObjectMetadata(sourceBucketName, sourceBucketKey); long length = sourceMetadata.getContentLength(); logTrace("<-", length + " bytes"); try { copyBlob(sourceBlobStore.config, sourceBucketKey, config, bucketKey, move); if (log.isDebugEnabled()) { long dtms = System.currentTimeMillis() - t0; log.debug("Copied s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey + " in " + dtms + "ms"); } return true; } catch (AmazonServiceException e) { logTrace("<--", "ERROR"); String message = "Direct copy failed from s3://" + sourceBucketName + "/" + sourceBucketKey + " to s3://" + bucketName + "/" + bucketKey + " (" + length + " bytes)"; log.warn(message + ", falling back to slow copy: " + e.getMessage()); log.debug(message, e); return false; } }