auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public String generate(Nameable nameable) throws MisoNamingException { for (DefaultMisoEntityPrefix prefix : DefaultMisoEntityPrefix.values()) { if (prefix.getClass().isAssignableFrom(nameable.getClass())) { <START> return prefix.name() + nameable.getId(); <END> } } throw new MisoNamingException("Cannot generate a MISO name from an object of type: " + nameable.getClass().getSimpleName()); }</code><technical_language>good throw a RuntimeException if more applies (nameable implements sample library for some reason)</technical_language>

Target:
public String generate(Nameable nameable) throws MisoNamingException { DefaultMisoEntityPrefix selected = null; for (DefaultMisoEntityPrefix prefix : DefaultMisoEntityPrefix.values()) { if (prefix.getClass().isAssignableFrom(nameable.getClass())) { if (selected != null) { throw new MisoNamingException("Multiple prefixes are available for object of type: " + nameable.getClass().getSimpleName()); } selected = prefix; } } if (selected == null) { throw new MisoNamingException("Cannot generate a MISO name from an object of type: " + nameable.getClass().getSimpleName()); } return selected.name() + nameable.getId(); }
Source:
<code>public byte[] getSha1Hash() { try { return getChecksum("SHA-1"); <START> } catch (NoSuchAlgorithmException e) { <END> VoltDB.crashLocalVoltDB("Bad JVM has no SHA-1 hash.", true, e); throw new RuntimeException("crashLocalVoltDB didn't work - this should be impossible, but exception is required to make compiler happy"); } }</code><technical_language>catch this in getChecksum crash</technical_language>

Target:
public byte[] getSha1Hash() { MessageDigest md = null; try { md = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException e) { VoltDB.crashLocalVoltDB("Bad JVM has no SHA-1 hash.", true, e); } for (Entry<String, byte[]> e : super.entrySet()) { if (e.getKey().equals("buildinfo.txt") || e.getKey().equals("catalog-report.html")) { continue; } if (e.getKey().equals(VoltCompiler.AUTOGEN_DDL_FILE_NAME)) { byte[] ddlbytes = e.getValue(); int index = 0; while (ddlbytes[index] != '\n') { index++; } byte[] newddlbytes = Arrays.copyOfRange(ddlbytes, index, ddlbytes.length); md.update(e.getKey().getBytes(Constants.UTF8ENCODING)); md.update(newddlbytes); } else { md.update(e.getKey().getBytes(Constants.UTF8ENCODING)); md.update(e.getValue()); } } return md.digest(); }
Source:
<code>public PropNValue(IntVar[] vars, IntVar nvalue) { super(ArrayUtils.concat(vars, nvalue), PropagatorPriority.LINEAR, true); this.nValue = nvalue; n = vars.length; <START> TIntArrayList list = new TIntArrayList(); <END> for(int i = 0; i<vars.length; i++) { for(int value = vars[i].getLB(); value <= vars[i].getUB(); value = vars[i].nextValue(value)) { if(!list.contains(value)) { list.add(value); } } } list.sort(); concernedValues = list.toArray(); possibleValues = SetFactory.makeStoredSet(SetType.BITSET, 0, model); mandatoryValues = SetFactory.makeStoredSet(SetType.BITSET, 0, model); witness = new IStateInt[concernedValues.length]; listForRandomPick = new TIntArrayList(); for(int j = 0; j<witness.length; j++) { witness[j] = getModel().getEnvironment().makeInt(-1); int value = concernedValues[j]; possibleValues.add(value); listForRandomPick.clear(); for(int i = 0; i<n; i++) { if(vars[i].isInstantiatedTo(value)) { mandatoryValues.add(value); witness[j].set(i); break; } else if(vars[i].contains(value)) { listForRandomPick.add(i); } } if(witness[j].get() == -1) { witness[j].set(listForRandomPick.getQuick(rnd.nextInt(listForRandomPick.size()))); } } }</code><technical_language>a TIntHashSet instead</technical_language>

Target:
public PropNValue(IntVar[] vars, IntVar nvalue) { super(ArrayUtils.concat(vars, nvalue), PropagatorPriority.LINEAR, true); this.nValue = nvalue; n = vars.length; TIntHashSet set = new TIntHashSet(); int min = Integer.MAX_VALUE; for(int i = 0; i<vars.length; i++) { for(int value = vars[i].getLB(); value <= vars[i].getUB(); value = vars[i].nextValue(value)) { set.add(value); min = Math.min(min, value); } } concernedValues = set.toArray(); possibleValues = SetFactory.makeStoredSet(SetType.BITSET, min, model); mandatoryValues = SetFactory.makeStoredSet(SetType.BITSET, min, model); witness = new int[concernedValues.length]; Arrays.fill(witness, -1); listForRandomPick = new TIntArrayList(); for(int j = 0; j<witness.length; j++) { possibleValues.add(concernedValues[j]); selectRandomWitness(j); } }
Source:
<code>public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { final C credential; final Class<C> crType; try { createAndInitCredentialStore(); <START> crType = credentialType != null ? credentialType : (Class<C>) credentialStoreReference.getType(); <END> credential = credentialStore.retrieve(credentialStoreReference.getAlias(), crType); } catch (CredentialStoreException e) { throw ElytronMessages.log.unableToReadCredential(e); } catch (UnsupportedCredentialTypeException e) { return null; } if (crType.isInstance(credential) && (parameterSpec == null || credential.impliesParameters(parameterSpec)) && (algorithmName == null || credential instanceof AlgorithmCredential && algorithmName.equals(((AlgorithmCredential) credential).getAlgorithm()))) { return credential; } else { return null; } }</code><technical_language>I understand credential store reference, is talk about, I in this case a couple of problems... First, credentialType null for CredentialSource. Second, cast Class objects this safely; instead do this: credentialStoreReference.getType().asSubclass(credentialType); yield a Class<? extends C> good enough for this case</technical_language>

Target:
public <C extends Credential> C getCredential(final Class<C> credentialType, final String algorithmName, final AlgorithmParameterSpec parameterSpec) throws IOException { Assert.checkNotNullParam("credentialType", credentialType); final C credential; try { createAndInitCredentialStore(); credential = credentialStore.retrieve(credentialStoreReference.getAlias(), credentialType); } catch (CredentialStoreException | ConfigXMLParseException e) { throw ElytronMessages.log.unableToReadCredential(e); } catch (UnsupportedCredentialTypeException e) { return null; } if (credentialType.isInstance(credential) && (parameterSpec == null || credential.impliesParameters(parameterSpec)) && (algorithmName == null || credential instanceof AlgorithmCredential && algorithmName.equals(((AlgorithmCredential) credential).getAlgorithm()))) { return credential; } else { return null; } }
Source:
<code>public MethodCallExpr buildBinding(DrlxParseSuccess drlxParseResult ) { MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL); if(drlxParseResult.hasUnificationVariable()) { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getUnificationVariable())); } else { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getExprBinding())); } final Expression constraintExpression = getConstraintExpression(drlxParseResult); MethodCallExpr bindAsDSL = new MethodCallExpr(bindDSL, BIND_AS_CALL); bindAsDSL.addArgument(context.getVarExpr(drlxParseResult.getPatternBinding())); <START> drlxParseResult.getUsedDeclarationsOnLeft().forEach(d -> bindAsDSL.addArgument(toVar(d))); <END> bindAsDSL.addArgument(constraintExpression); return buildReactOn( drlxParseResult, bindAsDSL ); }</code><technical_language>(almost) call static toVar directly, context.getVar() care of managing scope of variable</technical_language>

Target:
public MethodCallExpr buildBinding(DrlxParseSuccess drlxParseResult ) { MethodCallExpr bindDSL = new MethodCallExpr(null, BIND_CALL); if(drlxParseResult.hasUnificationVariable()) { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getUnificationVariable())); } else { bindDSL.addArgument(context.getVarExpr(drlxParseResult.getExprBinding())); } final Expression constraintExpression = getConstraintExpression(drlxParseResult); MethodCallExpr bindAsDSL = new MethodCallExpr(bindDSL, BIND_AS_CALL); bindAsDSL.addArgument(context.getVarExpr(drlxParseResult.getPatternBinding())); drlxParseResult.getUsedDeclarationsOnLeft().forEach(d -> bindAsDSL.addArgument(context.getVar(d))); bindAsDSL.addArgument(constraintExpression); return buildReactOn( drlxParseResult, bindAsDSL ); }
Source:
<code><START> private static void mockAdapterRegistry(BackendDefinitionAdapter definitionAdapter, BackendDefinitionSetAdapter definitionSetAdapter, BackendPropertySetAdapter propertySetAdapter, BackendPropertyAdapter propertyAdapter) { <END> when(adapterRegistry.getDefinitionSetAdapter(any(Class.class))).thenReturn(definitionSetAdapter); when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter); when(adapterRegistry.getPropertySetAdapter(any(Class.class))).thenReturn(propertySetAdapter); when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter); }</code><technical_language>Do methods need static</technical_language>

Target:
private void mockAdapterRegistry(BackendDefinitionAdapter definitionAdapter, BackendDefinitionSetAdapter definitionSetAdapter, BackendPropertySetAdapter propertySetAdapter, BackendPropertyAdapter propertyAdapter) { when(adapterRegistry.getDefinitionSetAdapter(any(Class.class))).thenReturn(definitionSetAdapter); when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter); when(adapterRegistry.getPropertySetAdapter(any(Class.class))).thenReturn(propertySetAdapter); when(adapterRegistry.getPropertyAdapter(any(Class.class))).thenReturn(propertyAdapter); }
Source:
<code>private void close(Path path) throws IOException { Path directoryWhereGeneratedArtifactsWasPlaced = path.getParent(); try (Stream<Path> s = Files.list(directoryWhereGeneratedArtifactsWasPlaced)) { <START> s.filter(p -> !Files.isDirectory(p)).map(ThrowingFunction.unchecked(p -> p)) <END> .forEach(ThrowingConsumer.unchecked(Files::delete)); } }</code><technical_language>map(ThrowingFunction.unchecked(p -> p)) unnecessary</technical_language>

Target:
private void close(Path path) throws IOException { Path directoryWhereGeneratedArtifactsWasPlaced = path.getParent(); try (Stream<Path> s = Files.list(directoryWhereGeneratedArtifactsWasPlaced)) { s.filter(p -> !Files.isDirectory(p)).forEach(ThrowingConsumer.unchecked(Files::delete)); } }
Source:
<code>public void transform(StructuredRecord valueIn, Emitter<StructuredRecord> emitter) { Schema inputSchema = valueIn.getSchema(); Schema outputSchema = getOutputSchema(inputSchema); StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field inputField : inputSchema.getFields()) { String inputFieldName = inputField.getName(); if (!fieldsToKeep.isEmpty()) { <START> if (!fieldsToKeep.contains(inputFieldName)) { <END> continue; } } else if (fieldsToDrop.contains(inputFieldName)) { continue; } String outputFieldName = fieldsToRename.get(inputFieldName); if (outputFieldName == null) { outputFieldName = inputFieldName; } Schema.Field outputField = outputSchema.getField(outputFieldName); Object inputVal = valueIn.get(inputFieldName); if (fieldsToConvert.containsKey(inputFieldName)) { convertAndSet(builder, outputFieldName, inputVal, inputField.getSchema(), outputField.getSchema()); } else { builder.set(outputFieldName, inputVal); } } emitter.emit(builder.build()); }</code><technical_language>simplified if condition, done in code</technical_language>

Target:
public void transform(StructuredRecord valueIn, Emitter<StructuredRecord> emitter) { Schema inputSchema = valueIn.getSchema(); Schema outputSchema = getOutputSchema(inputSchema); StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field inputField : inputSchema.getFields()) { String inputFieldName = inputField.getName(); if (!fieldsToKeep.isEmpty() && !fieldsToKeep.contains(inputFieldName)) { continue; } else if (fieldsToDrop.contains(inputFieldName)) { continue; } String outputFieldName = fieldsToRename.get(inputFieldName); if (outputFieldName == null) { outputFieldName = inputFieldName; } Schema.Field outputField = outputSchema.getField(outputFieldName); Object inputVal = valueIn.get(inputFieldName); if (fieldsToConvert.containsKey(inputFieldName)) { convertAndSet(builder, outputFieldName, inputVal, inputField.getSchema(), outputField.getSchema()); } else { builder.set(outputFieldName, inputVal); } } emitter.emit(builder.build()); }
Source:
<code>public void doRun() { try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates")) { for (TimeGraphEntry entry : fZoomEntryList) { if (getMonitor().isCanceled()) { log.addData("canceled", true); return; } if (entry == null) { break; } zoom(entry, getMonitor()); } <START> zoomEntries(fZoomEntryList, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()); <END> } List<ILinkEvent> events; try (TraceCompassLogUtils.ScopeLog linkLog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { events = getLinks(); } try (TraceCompassLogUtils.ScopeLog markerLoglog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { List<IMarkerEvent> markers = new ArrayList<>(getViewMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); applyResults(() -> { if (events != null) { fTimeGraphViewer.setLinks(events); } fTimeGraphViewer.setMarkerCategories(getMarkerCategories()); fTimeGraphViewer.setMarkers(markers); redraw(); }); } }</code><technical_language>calling zoom zoomEntries entries processed twice</technical_language>

Target:
public void doRun() { try (TraceCompassLogUtils.ScopeLog log = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingStates")) { zoomEntries(fZoomEntryList, getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor()); } List<ILinkEvent> events; try (TraceCompassLogUtils.ScopeLog linkLog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingLinks")) { events = getLinks(); } try (TraceCompassLogUtils.ScopeLog markerLoglog = new TraceCompassLogUtils.ScopeLog(LOGGER, Level.FINER, "ZoomThread:GettingMarkers")) { List<IMarkerEvent> markers = new ArrayList<>(getViewMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); markers.addAll(getTraceMarkerList(getZoomStartTime(), getZoomEndTime(), getResolution(), getMonitor())); applyResults(() -> { if (events != null) { fTimeGraphViewer.setLinks(events); } fTimeGraphViewer.setMarkerCategories(getMarkerCategories()); fTimeGraphViewer.setMarkers(markers); redraw(); }); } }
Source:
<code>private float getDesiredViewDistance(SolGame game) { Hero hero = game.getHero(); if (hero.isAlive() && hero.isTranscendent()) { return Const.CAM_VIEW_DIST_SPACE; } else if (hero.isDead()) { return Const.CAM_VIEW_DIST_GROUND; } else { <START> float velocity = hero.getVelocity().len(); <END> float desiredViewDistance = Const.CAM_VIEW_DIST_SPACE; Planet nearestPlanet = game.getPlanetManager().getNearestPlanet(position); if (nearestPlanet.getFullHeight() < nearestPlanet.getPosition().dst(position) && MAX_ZOOM_SPD < velocity) { desiredViewDistance = Const.CAM_VIEW_DIST_JOURNEY; } else if (nearestPlanet.isNearGround(position) && velocity < MED_ZOOM_SPD) { desiredViewDistance = Const.CAM_VIEW_DIST_GROUND; } desiredViewDistance += hero.getHull().config.getApproxRadius(); return desiredViewDistance; } }</code><technical_language>suggestion float speed = hero.getVelocity().len();</technical_language>

Target:
private float getDesiredViewDistance(SolGame game) { Hero hero = game.getHero(); if (hero.isAlive() && hero.isTranscendent()) { return Const.CAM_VIEW_DIST_SPACE; } else if (hero.isDead()) { return Const.CAM_VIEW_DIST_GROUND; } else { float speed = hero.getVelocity().len(); float desiredViewDistance = Const.CAM_VIEW_DIST_SPACE; Planet nearestPlanet = game.getPlanetManager().getNearestPlanet(position); if (nearestPlanet.getFullHeight() < nearestPlanet.getPosition().dst(position) && MAX_ZOOM_SPD < speed) { desiredViewDistance = Const.CAM_VIEW_DIST_JOURNEY; } else if (nearestPlanet.isNearGround(position) && speed < MED_ZOOM_SPD) { desiredViewDistance = Const.CAM_VIEW_DIST_GROUND; } desiredViewDistance += hero.getHull().config.getApproxRadius(); return desiredViewDistance; } }
Source:
<code>public ProcessStatus check() { if (temporaryTransactOnOutput != null) { if (!outputDock.pushTransact(temporaryTransactOnOutput)) return ProcessStatus.FAILURE; temporaryTransactOnOutput = null; } <START> Transact currentTransact = inputDock.pullTransact(); <END> if (currentTransact == null) return ProcessStatus.NOTHING_TO_DO; System.out.println(Simulator.getTime() + ": advance body " + currentTransact.getNumber()); Double time = Simulator.getTime() + interval.get(); Simulator.pushEvent(new AdvanceEvent(currentTransact, time)); currentTransact = null; return ProcessStatus.SUCCESS; }</code><technical_language>currentTransact -> transact</technical_language>

Target:
public BlockStatus check() { if (temporaryTransactOnOutput != null) { if (outputDock.hasTransact()) return BlockStatus.CHECK_AGAIN; outputDock.pushTransact(temporaryTransactOnOutput); temporaryTransactOnOutput = null; } Transact transact = inputDock.pullTransact(); if (transact == null) return BlockStatus.NOTHING_TO_DO; System.out.println(Simulator.getTime() + ": advance body " + transact.getNumber()); Double time = Simulator.getTime() + duration.get(); Simulator.pushEvent(new AdvanceEvent(transact, time)); return BlockStatus.SUCCESS; }
Source:
<code>private String getStatusMessage(AbstractBuild r) { Result result = r.getResult(); Result previousResult; if(null != result) { Run previousBuild = r.getProject().getLastBuild().getPreviousBuild(); Run previousSuccessfulBuild = r.getPreviousSuccessfulBuild(); boolean buildHasSucceededBefore = previousSuccessfulBuild != null; Run lastNonAbortedBuild = previousBuild; while(lastNonAbortedBuild != null && lastNonAbortedBuild.getResult() == Result.ABORTED) { lastNonAbortedBuild = lastNonAbortedBuild.getPreviousBuild(); } if(lastNonAbortedBuild == null) { previousResult = Result.SUCCESS; } else { previousResult = lastNonAbortedBuild.getResult(); } if (result == Result.SUCCESS && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE) && buildHasSucceededBefore && notifier.getNotifyBackToNormal()) { return BACK_TO_NORMAL_STATUS_MESSAGE; } if (result == Result.FAILURE && previousResult == Result.FAILURE) { return STILL_FAILING_STATUS_MESSAGE; } if (result == Result.SUCCESS) { return SUCCESS_STATUS_MESSAGE; } if (result == Result.FAILURE) { return FAILURE_STATUS_MESSAGE; } if (result == Result.ABORTED) { return ABORTED_STATUS_MESSAGE; } if (result == Result.NOT_BUILT) { return NOT_BUILT_STATUS_MESSAGE; } if (result == Result.UNSTABLE) { return UNSTABLE_STATUS_MESSAGE; } if (lastNonAbortedBuild != null && result.isWorseThan(previousResult)) { return REGRESSION_STATUS_MESSAGE; } } <START> return UNKNOWN_STATUS_MESSAGE; <END> }</code><technical_language>Note returning for Pipeline. "In progress"</technical_language>

Target:
private String getStatusMessage(AbstractBuild r) { Result result = r.getResult(); Result previousResult; if(null != result) { AbstractBuild lastBuild = r.getProject().getLastBuild(); if (lastBuild != null) { Run previousBuild = lastBuild.getPreviousBuild(); Run previousSuccessfulBuild = r.getPreviousSuccessfulBuild(); boolean buildHasSucceededBefore = previousSuccessfulBuild != null; Run lastNonAbortedBuild = previousBuild; while (lastNonAbortedBuild != null && lastNonAbortedBuild.getResult() == Result.ABORTED) { lastNonAbortedBuild = lastNonAbortedBuild.getPreviousBuild(); } if (lastNonAbortedBuild == null) { previousResult = Result.SUCCESS; } else { previousResult = lastNonAbortedBuild.getResult(); } if (result == Result.SUCCESS && (previousResult == Result.FAILURE || previousResult == Result.UNSTABLE) && buildHasSucceededBefore && notifier.getNotifyBackToNormal()) { return BACK_TO_NORMAL_STATUS_MESSAGE; } if (result == Result.FAILURE && previousResult == Result.FAILURE) { return STILL_FAILING_STATUS_MESSAGE; } if (result == Result.SUCCESS) { return SUCCESS_STATUS_MESSAGE; } if (result == Result.FAILURE) { return FAILURE_STATUS_MESSAGE; } if (result == Result.ABORTED) { return ABORTED_STATUS_MESSAGE; } if (result == Result.NOT_BUILT) { return NOT_BUILT_STATUS_MESSAGE; } if (result == Result.UNSTABLE) { return UNSTABLE_STATUS_MESSAGE; } if (lastNonAbortedBuild != null && result.isWorseThan(previousResult)) { return REGRESSION_STATUS_MESSAGE; } } } return UNKNOWN_STATUS_MESSAGE; }
Source:
<code>public HttpMessage cookie(Cookie cookie) { <START> this.cookies.add(cookie); <END> setHeader( HttpMessageHeaders.HTTP_COOKIE_PREFIX + cookie.getName(), cookieConverter.getCookieString(cookie)); return this; }</code><technical_language>sense overwrite cookies name (i.e. check name if in list overwrite allowing multiple cookies name)</technical_language>

Target:
public HttpMessage cookie(Cookie cookie) { this.cookies.put(cookie.getName(), cookie); setHeader( HttpMessageHeaders.HTTP_COOKIE_PREFIX + cookie.getName(), cookieConverter.getCookieString(cookie)); return this; }
Source:
<code>public ItemType getItemType() { <START> return Sponge.getRegistry().getType( <END> ItemType.class, this.statId.substring(this.statId.lastIndexOf('.') + 1)).get(); }</code><technical_language>bypass this ItemTypeRegistryModule itself</technical_language>

Target:
public ItemType getItemType() { return ItemTypeRegistryModule.getInstance().getById( this.statId.substring(this.statId.lastIndexOf('.') + 1)).get(); }
Source:
<code>public static boolean ignoreLocalTestServices() { <START> return Boolean.parseBoolean(System.getProperty("org.eclipse.mylyn.tests.ignore.local.services")); <END> }</code><technical_language>a constant for this</technical_language>

Target:
public static boolean ignoreLocalTestServices() { return Boolean.parseBoolean(System.getProperty(KEY_IGNORE_LOCAL_SERVICES)); }
Source:
<code>private TestDescription testDescriptionFrom(ExtensionContext context) { return new TestDescription() { @Override public String getTestId() { return context.getUniqueId(); } @Override public String getFilesystemFriendlyName() { <START> return context.getDisplayName(); <END> } }; }</code><technical_language>Display name filesystem friendly</technical_language>

Target:
private TestDescription testDescriptionFrom(ExtensionContext context) { return new TestcontainersTestDescription( context.getUniqueId(), filesystemFriendlyNameOf(context) ); }
Source:
<code>private void apply(TaskAdded event) { <START> getBuilder().setValue("Description value").build(); <END> }</code><technical_language>above, method nothing</technical_language>

Target:
private void apply(TaskAdded event) { getBuilder().setValue("Description value"); }
Source:
<code>private Stream<Output> queryAsStream( List<String> terms, ReadOnlyFulltext indexReader ) { <START> Stream<Output> stream; <END> PrimitiveLongIterator primitiveLongIterator = indexReader.fuzzyQuery( terms.toArray( new String[0] ) ); Iterable<Output> iterable = () -> new Iterator<Output>() { @Override public boolean hasNext() { return primitiveLongIterator.hasNext(); } @Override public Output next() { return new Output( primitiveLongIterator.next() ); } }; stream = StreamSupport.stream( iterable.spliterator(), false ); return stream; }</code><technical_language>this updated like: PrimitiveLongIterator primitiveLongIterator = indexReader.fuzzyQuery( terms.toArray( new String[0] ) ); Iterator<Output> iterator = PrimitiveLongCollections.map( Output::new, primitiveLongIterator ); return StreamSupport.stream( Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED), false );</technical_language>

Target:
private Stream<Output> queryAsStream( List<String> terms, ReadOnlyFulltext indexReader ) { PrimitiveLongIterator primitiveLongIterator = indexReader.fuzzyQuery( terms.toArray( new String[0] ) ); Iterator<Output> iterator = PrimitiveLongCollections.map( Output::new, primitiveLongIterator ); return StreamSupport.stream( Spliterators.spliteratorUnknownSize( iterator, Spliterator.ORDERED ), false ); }
Source:
<code>public void testMatchDNSName() throws Exception { DefaultHostnameVerifier.matchDNSName( "host.domain.com", Collections.singletonList(SubjectName.DNS("*.domain.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "host.xx", Collections.singletonList(SubjectName.DNS("*.xx")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "host.appspot.com", Collections.singletonList(SubjectName.DNS("*.appspot.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "demo-s3-bucket.s3.eu-central-1.amazonaws.com", Collections.singletonList(SubjectName.DNS("*.s3.eu-central-1.amazonaws.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "hostname-workspace-1.ops.domain.local", <START> Collections.singletonList(SubjectName.DNS("hostname-workspace-1.ops.domain.local")), <END> publicSuffixMatcher); }</code><technical_language>Call stupid, [this](<LINK_0> list include .local domain [RFC 6762, section 3](<LINK_1> this hostname is invalid. a single DNS label is allowed in .local domain</technical_language>

Target:
public void testMatchDNSName() throws Exception { DefaultHostnameVerifier.matchDNSName( "host.domain.com", Collections.singletonList(SubjectName.DNS("*.domain.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "host.xx", Collections.singletonList(SubjectName.DNS("*.xx")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "host.appspot.com", Collections.singletonList(SubjectName.DNS("*.appspot.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "demo-s3-bucket.s3.eu-central-1.amazonaws.com", Collections.singletonList(SubjectName.DNS("*.s3.eu-central-1.amazonaws.com")), publicSuffixMatcher); DefaultHostnameVerifier.matchDNSName( "hostname-workspace-1.local", Collections.singletonList(SubjectName.DNS("hostname-workspace-1.local")), publicSuffixMatcher); }
Source:
<code>public R apply(R record) { if (record.headers().isEmpty()) { <START> throw new DataException("The message does not contain headers."); <END> } headers.forEach(record.headers()::remove); return record; }</code><technical_language>goal of this SMT is remove records headers names in SMT's configuration. tolerant of a record headers of named headers. Secondly, want modify record passed in; create a new record. So, headers a Set<String> (noticeably more efficient) do like: if (record == null) { return null; } Headers recordHeaders = record.headers(); Headers newHeaders = new ConnectHeaders(); Iterator<Header> iterator = recordHeaders.iterator(); while (iterator.hasNext()) { Header header = iterator.next(); if (!headers.contains(header.key())) { recordHeaders.add(header); } } return record.newRecord(record.topic(), record.kafkaPartition(), record.keySchema(), record.key(), record.valueSchema(), updatedValue, record.timestamp(), newHeaders);</technical_language>

Target:
public R apply(R record) { if (record == null) { return null; } Headers recordHeaders = record.headers(); if (recordHeaders.isEmpty()) { return record; } Headers newHeaders = new ConnectHeaders(); recordHeaders.forEach(header -> { if (!headerNames.contains(header.key())) { newHeaders.add(header); } } ); return record.newRecord(record.topic(), record.kafkaPartition(), record.keySchema(), record.key(), record.valueSchema(), record.value(), record.timestamp(), newHeaders); }
Source:
<code>public void removesMagicFolder() { <START> PersistentStoragePathSanitizer.sanitizeStoragePath(testFolderPath).toFile().mkdir(); <END> PersistentStoragePathSanitizer.sanitizeStoragePath(testFolderPath); assertThat(testFolder.getRoot().listFiles()).isEmpty(); }</code><technical_language>guarantee this file exists in between, assertion please</technical_language>

Target:
public void removesMagicFolder() { PersistentStoragePathSanitizer.sanitizeStoragePath(testFolderPath).toFile().mkdir(); assertThat(testFolder.getRoot().listFiles()) .hasSize(1); PersistentStoragePathSanitizer.sanitizeStoragePath(testFolderPath); assertThat(testFolder.getRoot().listFiles()) .as("Sanitization should remove the special subfolder.") .isEmpty(); }
Source:
<code>protected void verifyRequirement(Collection<IRequirement> requirement, String filter, int min, int max, boolean greedy) { IExpression expr = ExpressionUtil.parse(filter); IMatchExpression<IInstallableUnit> matchExpr = ExpressionUtil.getFactory().matchExpression(expr); for (Iterator iterator = requirement.iterator(); iterator.hasNext();) { IRequirement required = (IRequirement) iterator.next(); <START> System.out.println(required); <END> if (required.getMatches().equals(matchExpr)) { String requirementDescr = "IRequirement " + filter; Assert.assertEquals("Min of " + requirementDescr, min, required.getMin()); Assert.assertEquals("Max of " + requirementDescr, max, required.getMax()); Assert.assertEquals("Greedy of " + requirementDescr, greedy, required.isGreedy()); return; } } Assert.fail("Missing IRequirement: " + filter); }</code><technical_language>removed</technical_language>

Target:
protected void verifyRequirement(Collection<IRequirement> requirement, String filter, int min, int max, boolean greedy) { IExpression expr = ExpressionUtil.parse(filter); IMatchExpression<IInstallableUnit> matchExpr = ExpressionUtil.getFactory().matchExpression(expr); for (Iterator iterator = requirement.iterator(); iterator.hasNext();) { IRequirement required = (IRequirement) iterator.next(); if (required.getMatches().equals(matchExpr)) { String requirementDescr = "IRequirement " + filter; Assert.assertEquals("Min of " + requirementDescr, min, required.getMin()); Assert.assertEquals("Max of " + requirementDescr, max, required.getMax()); Assert.assertEquals("Greedy of " + requirementDescr, greedy, required.isGreedy()); return; } } Assert.fail("Missing IRequirement: " + filter); }
Source:
<code>public void executionSkipped(final TestIdentifier testIdentifier, final String reason) { <START> if (!testIdentifier.isContainer()) { <END> listener.onTestSkipped(); } }</code><technical_language>early return if (testIdent.isContainer())</technical_language>

Target:
public void executionSkipped(final TestIdentifier testIdentifier, final String reason) { if (testIdentifier.isContainer()) { return; } listener.onTestSkipped(); }
Source:
<code>@Test public void getDeletedSecretSeriesById() { long now = OffsetDateTime.now().toEpochSecond(); <START> long id = secretSeriesDAO.createSecretSeries("toBeFound_getSecretSeriesByDeletedName", <END> "creator", "", null, null, now); long oldContentId = secretContentDAO.createSecretContent(id, "blah", "checksum", "creator", null, 0, now); secretSeriesDAO.setCurrentVersion(id, oldContentId, "creator", now); secretSeriesDAO.deleteSecretSeriesById(id); assertThat(secretSeriesDAO.getSecretSeriesById(id)).isEmpty(); Optional<SecretSeries> deletedSecretSeries = secretSeriesDAO.getDeletedSecretSeriesById(id); assertThat(deletedSecretSeries).isPresent(); assertThat(deletedSecretSeries.get().name()).contains("toBeFound_getSecretSeriesByDeletedName"); assertThat(deletedSecretSeries.get().name()).isNotEqualTo("toBeFound_getSecretSeriesByDeletedName"); assertThat(deletedSecretSeries.get().id()).isEqualTo(id); }</code><technical_language>nit: secret called toBeFound_getSecretSeriesByDeletedId a unique name compared other new test. Unfortunately, table is reset tests, duplicate secret names unexpected behavior</technical_language>

Target:
@Test public void getDeletedSecretSeriesById() { long now = OffsetDateTime.now().toEpochSecond(); long id = secretSeriesDAO.createSecretSeries("toBeFound_getSecretSeriesByDeletedId", "creator", "", null, null, now); long oldContentId = secretContentDAO.createSecretContent(id, "blah", "checksum", "creator", null, 0, now); secretSeriesDAO.setCurrentVersion(id, oldContentId, "creator", now); secretSeriesDAO.deleteSecretSeriesById(id); assertThat(secretSeriesDAO.getSecretSeriesById(id)).isEmpty(); Optional<SecretSeries> deletedSecretSeries = secretSeriesDAO.getDeletedSecretSeriesById(id); assertThat(deletedSecretSeries).isPresent(); assertThat(deletedSecretSeries.get().name()).contains("toBeFound_getSecretSeriesByDeletedId"); assertThat(deletedSecretSeries.get().name()).isNotEqualTo("toBeFound_getSecretSeriesByDeletedId"); assertThat(deletedSecretSeries.get().id()).isEqualTo(id); }
Source:
<code>public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (isVmInDb) { if (pendingAsyncTasks) { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE : AuditLogType.USER_FAILED_ADD_VM_TEMPLATE; } else { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_FINISHED_SUCCESS : getAuditLogFailureType(); } } else { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_SUCCESS : AuditLogType.USER_ADD_VM_TEMPLATE_FAILURE; } case END_SUCCESS: if (isVmInDb) { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_FINISHED_SUCCESS : getAuditLogFailureType(); } <START> return AuditLogType.UNASSIGNED; <END> default: return getAuditLogFailureType(); } }</code><technical_language>concerned importing image glance a template supposed get isVmInDb=false do want produce audit log in case. 1. specifically for instance-types? 2. do logs for creation of instance type look</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { switch (getActionState()) { case EXECUTE: if (isVmInDb) { if (pendingAsyncTasks) { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE : AuditLogType.USER_FAILED_ADD_VM_TEMPLATE; } else { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_FINISHED_SUCCESS : getAuditLogFailureType(); } } else { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_SUCCESS : AuditLogType.USER_ADD_VM_TEMPLATE_FAILURE; } case END_SUCCESS: if (getParameters().getTemplateType() != VmEntityType.INSTANCE_TYPE) { return getSucceeded() ? AuditLogType.USER_ADD_VM_TEMPLATE_FINISHED_SUCCESS : getAuditLogFailureType(); } return AuditLogType.UNASSIGNED; default: return getAuditLogFailureType(); } }
Source:
<code>private void processEvent(int cfIndex, byte[] keyBytes, byte[] valueBytes, OMDBUpdateEvent.OMDBUpdateAction action) throws IOException { String tableName = tablesNames.get(cfIndex); Class keyType = getKeyType(tableName); Class valueType = getValueType(tableName); if (valueType != null) { OMDBUpdateEvent.OMUpdateEventBuilder builder = new OMDBUpdateEvent.OMUpdateEventBuilder<>(); builder.setTable(tableName); Object key = codecRegistry.asObject(keyBytes, keyType); builder.setKey(key); if (!action.equals(OMDBUpdateEvent.OMDBUpdateAction.DELETE)) { Object value = codecRegistry.asObject(valueBytes, valueType); builder.setValue(value); } builder.setAction(action); OMDBUpdateEvent event = builder.build(); <START> LOG.info("Generated OM update Event for table : " + event.getTable() <END> + ", Key = " + event.getKey() + ", action = " + event.getAction()); omdbUpdateEvents.add(event); } }</code><technical_language>change this debug</technical_language>

Target:
private void processEvent(int cfIndex, byte[] keyBytes, byte[] valueBytes, OMDBUpdateEvent.OMDBUpdateAction action) throws IOException { String tableName = tablesNames.get(cfIndex); Class keyType = getKeyType(tableName); Class valueType = getValueType(tableName); if (valueType != null) { OMDBUpdateEvent.OMUpdateEventBuilder builder = new OMDBUpdateEvent.OMUpdateEventBuilder<>(); builder.setTable(tableName); Object key = codecRegistry.asObject(keyBytes, keyType); builder.setKey(key); if (!action.equals(OMDBUpdateEvent.OMDBUpdateAction.DELETE)) { Object value = codecRegistry.asObject(valueBytes, valueType); builder.setValue(value); } builder.setAction(action); OMDBUpdateEvent event = builder.build(); LOG.debug("Generated OM update Event for table : " + event.getTable() + ", Key = " + event.getKey() + ", action = " + event.getAction()); omdbUpdateEvents.add(event); } }
Source:
<code><START> public static synchronized AmplitudeClient getInstance(String instance) { <END> if (TextUtils.isEmpty(instance)) { instance = Constants.DEFAULT_INSTANCE; } instance = instance.toLowerCase(); AmplitudeClient client = instances.get(instance); if (client == null) { client = new AmplitudeClient(instance); instances.put(instance, client); } return client; }</code><technical_language>Extra space synchronized</technical_language>

Target:
public static synchronized AmplitudeClient getInstance(String instance) { instance = Utils.normalizeInstanceName(instance); AmplitudeClient client = instances.get(instance); if (client == null) { client = new AmplitudeClient(instance); instances.put(instance, client); } return client; }
Source:
<code>private void overwriteSample(final List<SAMReadGroupRecord> readGroups, final String sampleAlias) { <START> for (final SAMReadGroupRecord rg : readGroups) { <END> rg.setSample(sampleAlias); } }</code><technical_language>forEach</technical_language>

Target:
private void overwriteSample(final List<SAMReadGroupRecord> readGroups, final String sampleAlias) { readGroups.forEach(rg -> rg.setSample(sampleAlias)); }
Source:
<code>public void loadConfiguration(GeoServerResourceLoader resourceLoader) throws IOException { synchronized (this) { Resource controlflow = resourceLoader.get(PROPERTYFILENAME); if (Resources.exists(controlflow)) { configFile = new PropertyFileWatcher(controlflow); <START> configFile.setKnownLastModified(System.currentTimeMillis()); <END> } } }</code><technical_language>Done this way, isStale() is return true a configuration restore, not? I wrong, files, leaving this method empty do trick... FileWatcher code, fail if file before, removed later. I a reason re-create watcher otherwise</technical_language>

Target:
public void loadConfiguration(GeoServerResourceLoader resourceLoader) throws IOException { synchronized (this) { Resource controlflow = resourceLoader.get(PROPERTYFILENAME); if (Resources.exists(controlflow)) { configFile = new PropertyFileWatcher(controlflow); } } }
Source:
<code>public void testWfsMetadataImpl() { assertThat(testWfsMetadata.getCoordinateOrder(), is(COORDINATE_ORDER)); assertThat(testWfsMetadata.getId(), is(TEST_ID)); <START> assertThat(testWfsMetadata.getDescriptors().size(), is(1)); <END> }</code><technical_language>hasSize(), 2</technical_language>

Target:
public void testWfsMetadataImpl() { assertThat(testWfsMetadata.getCoordinateOrder(), is(COORDINATE_ORDER)); assertThat(testWfsMetadata.getId(), is(TEST_ID)); assertThat(testWfsMetadata.getDescriptors(), hasSize(1)); }
Source:
<code><START> private long resolve(AclStatus aclStatus) { <END> String owner = aclStatus.getOwner(); String group = aclStatus.getGroup(); short permission = aclStatus.getPermission().toShort(); return buildPermissionStatus(owner, group, permission); }</code><technical_language>static</technical_language>

Target:
private long resolve(AclStatus aclStatus) { String resolvedOwner = user(aclStatus.getOwner()); String resolvedGroup = group(aclStatus.getGroup()); FsPermission resolvedPermision = permission(aclStatus.getPermission()); return buildPermissionStatus( resolvedOwner, resolvedGroup, resolvedPermision.toShort()); }
Source:
<code>private InternalContainerResource createAndMapContainerResource(final WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final InternalContainerResource internalContainerResource = new InternalContainerResource( normalize(taskExecutorProcessSpec.getTotalProcessMemorySize().getMebiBytes(), minMemMB), normalize(taskExecutorProcessSpec.getCpuCores().getValue().intValue(), minVcore), <START> ExternalResourceUtils.getExternalResourcesForYarn(flinkConfig)); <END> if (resourceWithinMaxAllocation(internalContainerResource)) { containerResourceToWorkerSpecs.computeIfAbsent(internalContainerResource, ignored -> new HashSet<>()) .add(workerResourceSpec); containerMemoryToContainerResource.computeIfAbsent(internalContainerResource.memory, ignored -> new HashSet<>()) .add(internalContainerResource); return internalContainerResource; } else { LOG.warn("Requested container resource exceeds yarn max allocation {}. Will not allocate resource.", internalContainerResource, new InternalContainerResource(maxMemMB, maxVcore, Collections.emptyMap())); return null; } }</code><technical_language>need compute external resources time create a Resource for a new WorkerResourceSpec. compute initially</technical_language>

Target:
private InternalContainerResource createAndMapContainerResource(final WorkerResourceSpec workerResourceSpec) { final TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromWorkerResourceSpec(flinkConfig, workerResourceSpec); final InternalContainerResource internalContainerResource = new InternalContainerResource( normalize(taskExecutorProcessSpec.getTotalProcessMemorySize().getMebiBytes(), minMemMB), normalize(taskExecutorProcessSpec.getCpuCores().getValue().intValue(), minVcore), externalResourceConfigs); if (resourceWithinMaxAllocation(internalContainerResource)) { containerResourceToWorkerSpecs.computeIfAbsent(internalContainerResource, ignored -> new HashSet<>()) .add(workerResourceSpec); containerMemoryToContainerResource.computeIfAbsent(internalContainerResource.memory, ignored -> new HashSet<>()) .add(internalContainerResource); return internalContainerResource; } else { LOG.warn("Requested container resource exceeds yarn max allocation {}. Will not allocate resource.", internalContainerResource, new InternalContainerResource(maxMemMB, maxVcore, Collections.emptyMap())); return null; } }
Source:
<code>public static NotificationListFragment newInstance() { NotificationListFragment fragment = new NotificationListFragment(); Bundle args = new Bundle(); fragment.setArguments(args); <START> return fragment; <END> }</code><technical_language>This change needed, right</technical_language>

Target:
public static NotificationListFragment newInstance() { return new NotificationListFragment(); }
Source:
<code>public AccountDiffPreference getAccountDiffPreference() { <START> AccountDiffPreference diffPref = null; <END> try { diffPref = dbProvider.get().accountDiffPreferences().get(getAccountId()); if (diffPref == null) { return AccountDiffPreference.createDefault(getAccountId()); } } catch (OrmException e) { log.warn("Cannot query account diff preferences", e); } return diffPref; }</code><technical_language>Please initialize a local variable null. Instead leave uninitialized compiler prove correctly populated use. Right this is hiding a bug diffPref null if database threw exception. crash JSON encoder in HostPageServlet. If database fails, return a default preference logging warning here</technical_language>

Target:
public AccountDiffPreference getAccountDiffPreference() { AccountDiffPreference diffPref; try { diffPref = dbProvider.get().accountDiffPreferences().get(getAccountId()); if (diffPref == null) { diffPref = AccountDiffPreference.createDefault(getAccountId()); } } catch (OrmException e) { log.warn("Cannot query account diff preferences", e); diffPref = AccountDiffPreference.createDefault(getAccountId()); } return diffPref; }
Source:
<code>public void testConcatOnNonEmptyListOfNestedLists() { List<List<List<Character>>> listOfNestedLists = Arrays.asList( Arrays.asList(Collections.singletonList('1'), Collections.singletonList('2')), Arrays.asList(Collections.singletonList('3'), Collections.emptyList()), Arrays.asList(Arrays.asList('4', '5', '6')); assertEquals( Arrays.asList(Collections.singletonList('1'), Collections.singletonList('2'), Collections.singletonList('3'), Collections.emptyList(), Arrays.asList(4, 5, 6)), <START> ListOps.concat(listOfNestedLists)); <END> }</code><technical_language>missing a closing bracket in listOfNestedLists is build is failing. This easier spot if split lines putting argument a function a new line putting closing bracket line end For example: List<List<List<Character>>> listOfNestedLists = Arrays.asList( Arrays.asList( Collections.singletonList('1'), Collections.singletonList('2') ), Arrays.asList( Collections.singletonList('3'), Collections.emptyList() ), Arrays.asList( Arrays.asList('4', '5', '6') ) ); assertEquals( Arrays.asList( Collections.singletonList('1'), Collections.singletonList('2'), Collections.singletonList('3'), Collections.emptyList(), Arrays.asList(4, 5, 6) ), ListOps.concat(listOfNestedLists) ); code a bit easier read. Especially for nested function calls this useful</technical_language>

Target:
public void testConcatOnNonEmptyListOfNestedLists() { List<List<List<Character>>> listOfNestedLists = Arrays.asList( Arrays.asList( Collections.singletonList('1'), Collections.singletonList('2') ), Collections.singletonList( Collections.singletonList('3') ), Collections.singletonList( Collections.emptyList() ), Collections.singletonList( Arrays.asList('4', '5', '6') ) ); assertEquals( Arrays.asList( Collections.singletonList('1'), Collections.singletonList('2'), Collections.singletonList('3'), Collections.emptyList(), Arrays.asList('4', '5', '6') ), ListOps.concat(listOfNestedLists) ); }
Source:
<code>static protected String guessFormatFromMimeType(String mimeType) { if (mimeType == null) { return null; } if (mimeType.contains("/xml")) { return "text/xml"; } if (mimeType.contains("/json")) { return "text/json"; } <START> <END> return null; }</code><technical_language>this function is duplicating functionality implemented elsewhere, storing a mapping MIME types formats in main/webapp/modules/core/MOD-INF/controller.js. issue solved simply adding relevant MIME types in controller.js? If patterns necessary, .*/xml.*, consider adding support for patterns in this MIME type registry</technical_language>

Target:
static protected String guessFormatFromMimeType(String mimeType) { String[] components = mimeType.split(";"); if (components.length == 0) { return null; } return ImportingManager.getFormatFromMimeType(components[0]); }
Source:
<code>public static long getDays(@NonNull Date date) { <START> return date.getTime() / (1000 * 60 * 60 * 24); <END> }</code><technical_language>replace this with: return date.getTime() / TimeUnit.DAYS.toMillis(1);</technical_language>

Target:
public static long getDays(@NonNull Date date) { return TimeUnit.MILLISECONDS.toDays(date.getTime()); }
Source:
<code>private void addHeaders(final HttpRequest httpRequest) throws IOException, SignatureException { final String date = DateFormatter.dateToRfc882(); httpRequest.addHeader(HOST, NetUtils.buildHostField(NetworkClientImpl.this.connectionDetails)); httpRequest.addHeader(DATE, date); httpRequest.addHeader(CONTENT_TYPE, this.ds3Request.getContentType()); <START> httpRequest.addHeader("User-Agent", "ds3_java_sdk"); <END> for(final Map.Entry<String, String> header: this.ds3Request.getHeaders().entries()) { httpRequest.addHeader(header.getKey(), header.getValue()); } if (!this.hash.isEmpty()) { httpRequest.addHeader(getHashType(ds3Request.getChecksumType()), this.hash); } httpRequest.addHeader(AUTHORIZATION, this.getSignature(new SignatureDetails( this.ds3Request.getVerb(), this.hash, this.ds3Request.getContentType(), date, canonicalizeAmzHeaders(this.ds3Request.getHeaders()), canonicalizeResource(this.ds3Request.getPath(), this.ds3Request.getQueryParams()), NetworkClientImpl.this.connectionDetails.getCredentials() ))); }</code><technical_language>This a constant other headers</technical_language>

Target:
private void addHeaders(final HttpRequest httpRequest) throws IOException, SignatureException { final String date = DateFormatter.dateToRfc882(); httpRequest.addHeader(HOST, NetUtils.buildHostField(NetworkClientImpl.this.connectionDetails)); httpRequest.addHeader(DATE, date); httpRequest.addHeader(CONTENT_TYPE, this.ds3Request.getContentType()); httpRequest.addHeader(USER_AGENT, AGENT_DS3_JAVA_SDK); for(final Map.Entry<String, String> header: this.ds3Request.getHeaders().entries()) { httpRequest.addHeader(header.getKey(), header.getValue()); } if (!this.hash.isEmpty()) { httpRequest.addHeader(getHashType(ds3Request.getChecksumType()), this.hash); } httpRequest.addHeader(AUTHORIZATION, this.getSignature(new SignatureDetails( this.ds3Request.getVerb(), this.hash, this.ds3Request.getContentType(), date, canonicalizeAmzHeaders(this.ds3Request.getHeaders()), canonicalizeResource(this.ds3Request.getPath(), this.ds3Request.getQueryParams()), NetworkClientImpl.this.connectionDetails.getCredentials() ))); }