auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void addReplacementsForPackage( ConcurrentHashMap<MethodSignature, MethodSignature> replacementMap, String originalPackage, String replacementPackage, ClassLoader loader) throws ReplacementException, IOException, ClassNotFoundException { boolean found = false; Enumeration<URL> resources; resources = loader.getResources(replacementPackage.replace('.', '/')); while (resources.hasMoreElements()) { URL url = resources.nextElement(); try { URLConnection connection = url.openConnection(); if (connection instanceof JarURLConnection) { JarFile jarFile = ((JarURLConnection) connection).getJarFile(); addReplacementsFromAllClassesOfPackage( replacementMap, originalPackage, replacementPackage, jarFile); } else { File path = new File(URLDecoder.decode(url.getPath(), "UTF-8")); if (path.exists() && path.isDirectory()) { addReplacementsForPackage(replacementMap, originalPackage, replacementPackage, path); found = true; } } } catch (IOException e) { String msg = String.format( "Error identifying replacement %s with a package: %s", replacementPackage, e.getMessage()); throw new ReplacementException(msg, e); } } if (!found) { String msg = String.format( <START> "No package or class for replacement %s found on classpath", replacementPackage); <END> throw new ReplacementException(msg); } }</code><technical_language>"or class" removed? a package here</technical_language>

Target:
private static void addReplacementsForPackage( ConcurrentHashMap<MethodSignature, MethodSignature> replacementMap, String originalPackage, String replacementPackage, ClassLoader loader) throws ReplacementException, IOException, ClassNotFoundException { boolean found = false; Enumeration<URL> resources = loader.getResources(replacementPackage.replace('.', '/')); while (resources.hasMoreElements()) { URL url = resources.nextElement(); try { URLConnection connection = url.openConnection(); if (connection instanceof JarURLConnection) { JarFile jarFile = ((JarURLConnection) connection).getJarFile(); addReplacementsFromAllClassesOfPackage( replacementMap, originalPackage, replacementPackage, jarFile); } else { File path = new File(URLDecoder.decode(url.getPath(), "UTF-8")); if (path.exists() && path.isDirectory()) { addReplacementsForPackage(replacementMap, originalPackage, replacementPackage, path); found = true; } } } catch (IOException e) { String msg = String.format( "Error identifying replacement %s with a package: %s", replacementPackage, e.getMessage()); throw new ReplacementException(msg, e); } } if (!found) { String msg = String.format("No package for replacement %s found on classpath", replacementPackage); throw new ReplacementException(msg); } }
Source:
<code><START> private void removeState(String workspaceId) throws ServerException { <END> try (@SuppressWarnings("unused") Unlocker u = locks.writeLock(workspaceId)) { states.remove(workspaceId); } }</code><technical_language>point throws ServerException, missed something</technical_language>

Target:
private void removeState(String workspaceId) { try (@SuppressWarnings("unused") Unlocker u = locks.writeLock(workspaceId)) { states.remove(workspaceId); } }
Source:
<code>public CommandResult<V> undo(final C context, final Command<C, V> command) { if (null != getDelegate()) { final CommandResult<V> r = getDelegate().undo(context, command); postUndo(context, command, <START> r); <END> return r; } return null; }</code><technical_language>Minor thing, please result instead of r</technical_language>

Target:
public CommandResult<V> undo(final C context, final Command<C, V> command) { if (null != getDelegate()) { preUndo(context, command); final CommandResult<V> result = getDelegate().undo(context, command); postUndo(context, command, result); return result; } return null; }
Source:
<code>private void updateECActions(boolean redo) { for (ECState state : fbType.getECC().getECState()) { for (ECAction action : state.getECAction()) { if <START> (redo == true) { <END> if (action.getAlgorithm() == oldAlgorithm) { action.setAlgorithm(newAlgorithm); } } else { if (action.getAlgorithm() == newAlgorithm) { action.setAlgorithm(oldAlgorithm); } } } } }</code><technical_language>const lhs in comparisons</technical_language>

Target:
private void updateECActions(boolean redo) { if (fbType instanceof BasicFBType) { for (ECState state : ((BasicFBType) fbType).getECC().getECState()) { for (ECAction action : state.getECAction()) { if (true == redo) { if (action.getAlgorithm() == oldAlgorithm) { action.setAlgorithm(newAlgorithm); } } else { if (action.getAlgorithm() == newAlgorithm) { action.setAlgorithm(oldAlgorithm); } } } } } }
Source:
<code>protected SimpleFeatureCollection getFeatures(OskariLayer layer, Envelope bbox, String requestSrsName, String targetSrsName) throws ActionException { CoordinateReferenceSystem requestCRS; CoordinateReferenceSystem targetCRS; try { requestCRS = CRS.decode(requestSrsName, true); targetCRS = CRS.decode(targetSrsName, true); } catch (Exception e) { <START> throw new ActionException(ERR_CRS_DECODE_FAIL); <END> } if (!isWithin(targetCRS, bbox)) { throw new ActionParamsException(ERR_BBOX_OUT_OF_CRS); } boolean shouldTransform = !CRS.equalsIgnoreMetadata(requestCRS, targetCRS); MathTransform transformFromRequested; MathTransform transformToRequested; Envelope requestBbox; if (shouldTransform) { try { transformFromRequested = CRS.findMathTransform(requestCRS, targetCRS, true); transformToRequested = CRS.findMathTransform(targetCRS, requestCRS, true); } catch (Exception e) { throw new ActionException(ERR_TRANSFORM_FIND_FAIL); } try { requestBbox = JTS.transform(bbox, transformToRequested); } catch (Exception e) { throw new ActionException(ERR_REPOJECTION_FAIL); } } else { transformFromRequested = null; transformToRequested = null; requestBbox = bbox; } SimpleFeatureCollection features = getFeatures(layer, requestSrsName, requestBbox); if (shouldTransform) { try { features = transform(features, targetCRS, transformFromRequested); } catch (Exception e) { throw new ActionException(ERR_REPOJECTION_FAIL); } } return features; }</code><technical_language>This ActionParamsException pass interesting</technical_language>

Target:
protected SimpleFeatureCollection getFeatures(OskariLayer layer, Envelope bbox, String requestSrsName, String targetSrsName) throws ActionException { CoordinateReferenceSystem requestCRS; CoordinateReferenceSystem targetCRS; try { requestCRS = CRS.decode(requestSrsName, true); targetCRS = CRS.decode(targetSrsName, true); } catch (Exception e) { throw new ActionParamsException(ERR_CRS_DECODE_FAIL); } if (!isWithin(targetCRS, bbox)) { throw new ActionParamsException(ERR_BBOX_OUT_OF_CRS); } boolean shouldTransform = !CRS.equalsIgnoreMetadata(requestCRS, targetCRS); MathTransform transformFromRequested; MathTransform transformToRequested; Envelope requestBbox; if (shouldTransform) { try { transformFromRequested = CRS.findMathTransform(requestCRS, targetCRS, true); transformToRequested = CRS.findMathTransform(targetCRS, requestCRS, true); } catch (Exception e) { throw new ActionParamsException(ERR_TRANSFORM_FIND_FAIL); } try { requestBbox = JTS.transform(bbox, transformToRequested); } catch (Exception e) { throw new ActionException(ERR_REPOJECTION_FAIL, e); } } else { transformFromRequested = null; transformToRequested = null; requestBbox = bbox; } SimpleFeatureCollection features = getFeatures(layer, requestSrsName, requestBbox); if (shouldTransform) { try { features = transform(features, targetCRS, transformFromRequested); } catch (Exception e) { throw new ActionException(ERR_REPOJECTION_FAIL, e); } } return features; }
Source:
<code>private void parseAnnotatedNameOrEmail(final String annotatedNameOrEmail) throws UnloggedFailure, OrmException { char action = annotatedNameOrEmail.charAt(0); if (action != '+' && action != '-') { throw error("\"" + annotatedNameOrEmail + "\" must begin with a '+' or '-'"); } final String nameOrEmail = annotatedNameOrEmail.substring(1); final Account account = accountResolver.find(nameOrEmail); <START> if (account == null || !account.isActive()) { <END> throw error("\"" + nameOrEmail + "\" is not an active user"); } if (allReviewers.containsKey(account.getId())) { throw error("\"" + nameOrEmail + "\" and \"" + allReviewers.get(account.getId()) + "\" are the same user"); } allReviewers.put(account.getId(), nameOrEmail); if (action == '+') { reviewersToAdd.add(nameOrEmail); } else { reviewersToRemove.add(account.getId()); } }</code><technical_language>able remove inactive user existing review. this fall handled addReviewerFactory adding user</technical_language>

Target:
private boolean parseAnnotatedNameOrEmail(final String annotatedNameOrEmail) throws UnloggedFailure { Set<String> matchingSet; Set<String> otherSet; switch (annotatedNameOrEmail.charAt(0)) { case '+': matchingSet = reviewersToAdd; otherSet = reviewersToRemove; break; case '-': matchingSet = reviewersToRemove; otherSet = reviewersToAdd; break; default: return false; } final String nameOrEmail = annotatedNameOrEmail.substring(1); if (otherSet.contains(nameOrEmail)) { throw error("You cannot both add and remove \"" + nameOrEmail + "\""); } matchingSet.add(nameOrEmail); return true; }
Source:
<code>protected void generate(IFile file, JobGroup jobGroup) { String filePath = file.getLocation().toFile().getAbsolutePath(); URI tpdURI = URI.createFileURI(filePath); Converter converter = new Converter(); Injector injector = TargetplatformActivator.getInstance().getInjector(TargetplatformActivator.ORG_ECLIPSE_CBI_TARGETPLATFORM_TARGETPLATFORM); injector.injectMembers(converter); Job job = new Job(Messages.GenerateTargetsHandler_GenerateTargetPlatformFor + file.getLocation().lastSegment()) { @Override protected IStatus run(IProgressMonitor monitor) { Diagnostic result = converter.generateTargetDefinitionFile(tpdURI, new NullProgressMonitor()); if (result.getSeverity() >= Diagnostic.WARNING) { Activator.getDefault().getLog().log(BasicDiagnostic.toIStatus(result)); } try { file.getParent().refreshLocal(IResource.DEPTH_ONE, null); generateEclipseTarget(file); } catch (CoreException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, <START> "Unexpected exception", <END> ex); } return BasicDiagnostic.toIStatus(result); } }; job.setJobGroup(jobGroup); job.schedule(); }</code><technical_language>close ! (for consistency's sake prefer moved new class) thanks for new message class ! :)</technical_language>

Target:
protected void generate(IFile file, JobGroup jobGroup) { String filePath = file.getLocation().toFile().getAbsolutePath(); URI tpdURI = URI.createFileURI(filePath); Converter converter = new Converter(); Injector injector = TargetplatformActivator.getInstance().getInjector(TargetplatformActivator.ORG_ECLIPSE_CBI_TARGETPLATFORM_TARGETPLATFORM); injector.injectMembers(converter); Job job = new Job(Messages.GenerateTargetsHandler_GenerateTargetPlatformFor + file.getLocation().lastSegment()) { @Override protected IStatus run(IProgressMonitor monitor) { Diagnostic result = converter.generateTargetDefinitionFile(tpdURI, new NullProgressMonitor()); if (result.getSeverity() >= Diagnostic.WARNING) { Activator.getDefault().getLog().log(BasicDiagnostic.toIStatus(result)); } try { file.getParent().refreshLocal(IResource.DEPTH_ONE, null); generateEclipseTarget(file); } catch (CoreException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.GenerateTargetsHandler_UnexpectedException, ex); } return BasicDiagnostic.toIStatus(result); } }; job.setJobGroup(jobGroup); job.schedule(); }
Source:
<code><START> private void updateCheckpointFileCache(final Map<TopicPartition, Long> checkpointableOffsetsFromProcessing) { <END> final Map<TopicPartition, Long> restoredOffsets = validCheckpointableOffsets(changelogReader.restoredOffsets()); log.trace("Checkpointable offsets updated with restored offsets: {}", checkpointFileCache); for (final TopicPartition topicPartition : validCheckpointableTopics()) { if (checkpointableOffsetsFromProcessing.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, checkpointableOffsetsFromProcessing.get(topicPartition) + 1); } else if (standbyRestoredOffsets.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, standbyRestoredOffsets.get(topicPartition)); } else if (restoredOffsets.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, restoredOffsets.get(topicPartition)); } else if (checkpointFileCache.containsKey(topicPartition)) { } else { final Long loadedOffset = validCheckpointableOffsets(initialLoadedCheckpoints).get(topicPartition); if (loadedOffset != null) { checkpointFileCache.put(topicPartition, loadedOffset); } } } }</code><technical_language>In this method, call validCheckpointableTopics times, validCheckpointableOffsets. sense call in beginning passing result validCheckpointableOffsets</technical_language>

Target:
private void updateCheckpointFileCache(final Map<TopicPartition, Long> checkpointableOffsetsFromProcessing) { final Set<TopicPartition> validCheckpointableTopics = validCheckpointableTopics(); final Map<TopicPartition, Long> restoredOffsets = validCheckpointableOffsets( changelogReader.restoredOffsets(), validCheckpointableTopics ); log.trace("Checkpointable offsets updated with restored offsets: {}", checkpointFileCache); for (final TopicPartition topicPartition : validCheckpointableTopics) { if (checkpointableOffsetsFromProcessing.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, checkpointableOffsetsFromProcessing.get(topicPartition) + 1); } else if (standbyRestoredOffsets.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, standbyRestoredOffsets.get(topicPartition)); } else if (restoredOffsets.containsKey(topicPartition)) { checkpointFileCache.put(topicPartition, restoredOffsets.get(topicPartition)); } else if (checkpointFileCache.containsKey(topicPartition)) { } else { final Long loadedOffset = validCheckpointableOffsets(initialLoadedCheckpoints, validCheckpointableTopics).get(topicPartition); if (loadedOffset != null) { checkpointFileCache.put(topicPartition, loadedOffset); } } } }
Source:
<code>public synchronized void leave() { if (!active) { return; } <START> hazelcast.getCluster().removeMembershipListener(nodeID); <END> hazelcast.getLifecycleService().shutdown(); active = false; }</code><technical_language>Instead of nodeID returned earlier call setMembershipListener</technical_language>

Target:
public synchronized void leave() { if (!active) { return; } boolean left = hazelcast.getCluster().removeMembershipListener(membershipListenerId); if (!left) { log.warn("Unable to remove membership listener"); } hazelcast.getLifecycleService().shutdown(); active = false; }
Source:
<code>public int deleteRuntimeStats(int maxRetainSecs) throws MetaException { if (maxRetainSecs < 0) { LOG.warn("runtime stats retention is disabled"); return 0; } boolean committed = false; try (Query q = pm.newQuery(MRuntimeStat.class)) { openTransaction(); int maxCreateTime = (int) (System.currentTimeMillis() / 1000) - maxRetainSecs; q.setFilter("createTime <= maxCreateTime"); q.declareParameters("int maxCreateTime"); long deleted = q.deletePersistentAll(maxCreateTime); committed = commitTransaction(); return (int) deleted; } catch (Exception e) { <START> throw new MetaException(e.getMessage()); <END> } finally { if (!committed) { rollbackTransaction(); } } }</code><technical_language>is this catch needed</technical_language>

Target:
public int deleteRuntimeStats(int maxRetainSecs) throws MetaException { if (maxRetainSecs < 0) { LOG.warn("runtime stats retention is disabled"); return 0; } boolean committed = false; Query q = null; try { openTransaction(); int maxCreateTime = (int) (System.currentTimeMillis() / 1000) - maxRetainSecs; q = pm.newQuery(MRuntimeStat.class); q.setFilter("createTime <= maxCreateTime"); q.declareParameters("int maxCreateTime"); long deleted = q.deletePersistentAll(maxCreateTime); committed = commitTransaction(); return (int) deleted; } finally { rollbackAndCleanup(committed, q); } }
Source:
<code>public Integer getNumberOfImageFiles(URI directory) { int count = 0; if (directory.isAbsolute()) { if (isDirectory(directory)) { <START> count = getSubUris(Helper.imageNameFilter, directory).size(); <END> ArrayList<URI> children = getSubUris(directory); for (URI aChildren : children) { count += getNumberOfImageFiles(aChildren); } } } else { directory = getAbsoluteURI(directory, MappingType.DATA, null, null); count = getSubUris(Helper.imageNameFilter, directory).size(); ArrayList<URI> children = getSubUris(directory); for (URI aChildren : children) { count += getNumberOfImageFiles(aChildren); } } return count; }</code><technical_language>add number of subdirectories a start for number of image files? a bit strange. in method getNumberOfFiles code lines of ifstatement similar separated</technical_language>

Target:
public Integer getNumberOfImageFiles(URI directory) { int count = 0; if (directory.isAbsolute()) { count += iterateOverImageDirectories(directory); } else { directory = getAbsoluteURI(directory, MappingType.DATA, null, null); count += iterateOverImageDirectories(directory); } return count; }
Source:
<code><T> StatefulEJBLocator<T> createSession(final StatelessEJBLocator<T> statelessLocator, final AuthenticationConfiguration authenticationConfiguration, final SSLContext sslContext) throws Exception { final LocatedAction<StatefulEJBLocator<T>, StatelessEJBLocator<T>, T> action = (receiver, originalLocator, newAffinity, ac, sc) -> receiver.createSession(originalLocator.withNewAffinity(newAffinity), ac, sc); if (Logs.INVOCATION.isDebugEnabled()) { <START> Logs.INVOCATION.debugf("Calling createSession(module = %s, strong affinity = %s): ", ((EJBLocator)statelessLocator).getIdentifier(), statelessLocator.getAffinity()); <END> } return performLocatedAction(statelessLocator, action, Affinity.NONE, authenticationConfiguration, sslContext); }</code><technical_language>This is a per-invocation log message, level TRACE. Also, log locator a string parameter a locator is a combination of module identifier affinity (plus view type, is harmful include in a log message). interpolation is required perform log statement, need enclosing is*Enabled stuff</technical_language>

Target:
<T> StatefulEJBLocator<T> createSession(final StatelessEJBLocator<T> statelessLocator, final AuthenticationConfiguration authenticationConfiguration, final SSLContext sslContext) throws Exception { final LocatedAction<StatefulEJBLocator<T>, StatelessEJBLocator<T>, T> action = (receiver, originalLocator, newAffinity, ac, sc) -> receiver.createSession(originalLocator.withNewAffinity(newAffinity), ac, sc); Logs.INVOCATION.tracef("Calling createSession(locator = %s)",statelessLocator); return performLocatedAction(statelessLocator, action, Affinity.NONE, authenticationConfiguration, sslContext); }
Source:
<code>public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", login=<").append(getLogin() == null ? "\\0" : BeansUtils.createEscaping(getLogin())).append(">").append( ", source=<").append(extSource == null ? "\\0" : getExtSource().serializeToString()).append(">").append( ", userId=<").append(getUserId()).append(">").append( ", loa=<").append(getLoa()).append(">").append( <START> ", lastAccess=<").append(lastAccess).append(">").append( <END> ']').toString(); }</code><technical_language>is true if omit initialization "now" in lastAccess: handle NULL case here. While non-null date is created in DB insert, returned object addUserExtSource() call this property set create auditer messages</technical_language>

Target:
public String serializeToString() { StringBuilder str = new StringBuilder(); return str.append(this.getClass().getSimpleName()).append(":[").append( "id=<").append(getId()).append(">").append( ", login=<").append(getLogin() == null ? "\\0" : BeansUtils.createEscaping(getLogin())).append(">").append( ", source=<").append(extSource == null ? "\\0" : getExtSource().serializeToString()).append(">").append( ", userId=<").append(getUserId()).append(">").append( ", loa=<").append(getLoa()).append(">").append( ", lastAccess=<").append(lastAccess == null ? "\\0" : BeansUtils.createEscaping(lastAccess)).append(">").append( ']').toString(); }
Source:
<code>public void testTokensNotNull() { final UnnecessarySemicolonInEnumerationCheck check = new UnnecessarySemicolonInEnumerationCheck(); Assert.assertNotNull("Acceptable tokens should not be null", check.getAcceptableTokens()); Assert.assertNotNull("Default tokens should not be null", check.getDefaultTokens()); <START> Assert.assertNotNull("Required tokens should not be null", check.getRequiredTokens()); <END> }</code><technical_language>do gain asserting null? assert some actual instead? covers null ensures some value</technical_language>

Target:
public void testTokensNotNull() { final UnnecessarySemicolonInEnumerationCheck check = new UnnecessarySemicolonInEnumerationCheck(); final int[] expected = { TokenTypes.ENUM_DEF, }; Assert.assertArrayEquals("Acceptable required tokens are invalid", expected, check.getAcceptableTokens()); Assert.assertArrayEquals("Default required tokens are invalid", expected, check.getDefaultTokens()); Assert.assertArrayEquals("Required required tokens are invalid", expected, check.getRequiredTokens()); }
Source:
<code>protected long getIdleTimeout(String wsId) throws NotFoundException, ServerException { <START> return defaultTimeout; <END> }</code><technical_language>do a test for this class</technical_language>

Target:
protected long getIdleTimeout(String wsId) { return defaultTimeout; }
Source:
<code><START> public Mono<Response<Key>> updateKey(KeyBase key) { <END> Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .tags(key.tags()) .keyOps(key.keyOperations()) .keyAttributes(new KeyRequestAttributes(key)); return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE); }</code><technical_language>Need add overload takes keyOps</technical_language>

Target:
public Mono<Response<Key>> updateKey(KeyBase key) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .tags(key.tags()) .keyAttributes(new KeyRequestAttributes(key)); return service.updateKey(endpoint, key.name(), key.version(), API_VERSION, ACCEPT_LANGUAGE, parameters, CONTENT_TYPE_HEADER_VALUE); }
Source:
<code>public Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> getQuestionResponseMapSortedByRecipient() { if (questions == null || responses == null) { return null; } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> sortedMap = new TreeMap<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>(); for (FeedbackQuestionAttributes question : questions.values()) { sortedMap.put(question, new ArrayList<FeedbackResponseAttributes>()); } for (FeedbackResponseAttributes response : responses) { List<FeedbackResponseAttributes> responsesForQuestion = sortedMap <START> .get(questions.get(response.feedbackQuestionId)); <END> responsesForQuestion.add(response); } for (List<FeedbackResponseAttributes> responsesForQuestion : sortedMap.values()) { Collections.sort(responsesForQuestion, compareByRecipientName); } return sortedMap; }</code><technical_language>extract questions.get(response.feedbackQuestionId) a variable more readable</technical_language>

Target:
public Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> getQuestionResponseMapSortedByRecipient() { if (questions == null || responses == null) { return null; } Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> sortedMap = new TreeMap<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>(); for (FeedbackQuestionAttributes question : questions.values()) { sortedMap.put(question, new ArrayList<FeedbackResponseAttributes>()); } for (FeedbackResponseAttributes response : responses) { FeedbackQuestionAttributes question = questions.get(response.feedbackQuestionId); List<FeedbackResponseAttributes> responsesForQuestion = sortedMap.get(question); responsesForQuestion.add(response); } for (List<FeedbackResponseAttributes> responsesForQuestion : sortedMap.values()) { Collections.sort(responsesForQuestion, compareByRecipientName); } return sortedMap; }
Source:
<code>public static <M, OM> StreamOperatorSpec<M, OM> createStreamOperatorSpec( FlatMapFunction<? super M, ? extends OM> transformFn, MessageStreamImpl<OM> nextStream, int opId) { <START> return new StreamOperatorSpec<>(new FlatMapFunction<M, OM>() { <END> @Override public Collection<OM> apply(M message) { ArrayList<OM> retVal = new ArrayList<OM>(); retVal.addAll(transformFn.apply(message)); return retVal; } @Override public void init(Config config, TaskContext context) { transformFn.init(config, context); } }, nextStream, OperatorSpec.OpCode.FLAT_MAP, opId); }</code><technical_language>Issue: create wrapper functions</technical_language>

Target:
public static <M, OM> StreamOperatorSpec<M, OM> createStreamOperatorSpec( FlatMapFunction<? super M, ? extends OM> transformFn, MessageStreamImpl<OM> nextStream, int opId) { return new StreamOperatorSpec<>((FlatMapFunction<M, OM>) transformFn, nextStream, OperatorSpec.OpCode.FLAT_MAP, opId); }
Source:
<code>public boolean matches(List<Type> sourceTypes, Type targetType) { if ( sourceTypes.size() > 1 ) { return false; } Type sourceType = sourceTypes.iterator().next(); if ( getReturnType().erasure().isAssignableTo( targetType.erasure() ) && sourceType.erasure().isAssignableTo( getParameter().getType().erasure() ) ) { return doTypeVarsMatch( sourceType, targetType ); } <START> if ( getReturnType().erasure().getFullyQualifiedName().equals( "java.lang.Object" ) <END> && sourceType.erasure().isAssignableTo( getParameter().getType().erasure() ) ) { return doTypeVarsMatch( sourceType, targetType ); } if ( getReturnType().erasure().isAssignableTo( targetType.erasure() ) && getParameter().getType().erasure().getFullyQualifiedName().equals( "java.lang.Object" ) ) { return doTypeVarsMatch( sourceType, targetType ); } return false; }</code><technical_language>Funny enough, implementation of erasure() results in a Type instance fullyQualifiedName original type... I guess needs corrected, too. :)</technical_language>

Target:
public boolean matches(List<Type> sourceTypes, Type targetType) { if ( sourceTypes.size() > 1 ) { return false; } Type sourceType = sourceTypes.iterator().next(); if ( getReturnType().isAssignableTo( targetType.erasure() ) && sourceType.erasure().isAssignableTo( getParameter().getType() ) ) { return doTypeVarsMatch( sourceType, targetType ); } if ( getReturnType().getFullyQualifiedName().equals( "java.lang.Object" ) && sourceType.erasure().isAssignableTo( getParameter().getType() ) ) { return doTypeVarsMatch( sourceType, targetType ); } if ( getReturnType().isAssignableTo( targetType.erasure() ) && getParameter().getType().getFullyQualifiedName().equals( "java.lang.Object" ) ) { return doTypeVarsMatch( sourceType, targetType ); } return false; }
Source:
<code>private void addMapReduceJobState(PigJob pigJob) { JobClient jobClientLocal = getJobClient(); try { String id = pigJob.getId(); RunningJob runningJob = null; try { runningJob = jobClientLocal.getJob(id); } catch (Exception e) { log.warn("Exception while querying job status for jobId=" + id +" message: " + e.getMessage()); log.debug(e); return; } if (runningJob == null) { log.warn("Couldn't find job status for jobId=" + id); return; } <START> Properties jobConfProperties = getJobConfFromFile(runningJob); <END> JobID jobID = runningJob.getID(); TaskReport[] mapTaskReport = jobClientLocal.getMapTaskReports(jobID); TaskReport[] reduceTaskReport = jobClientLocal.getReduceTaskReports(jobID); if (jobConfProperties != null && jobConfProperties.size() > 0) { pigJob.setConfiguration(jobConfProperties); } pigJob.setMapReduceJobState( new MapReduceJobState(runningJob, mapTaskReport, reduceTaskReport)); } catch (IOException e) { log.warn("Error occurred when retrieving job progress info. ", e); } }</code><technical_language>IIRC, this hideous catch NPE for runningJob, for buried in impl of getID()</technical_language>

Target:
private void addMapReduceJobState(PigJob pigJob) { JobClient jobClientLocal = getJobClient(); try { String id = pigJob.getId(); RunningJob runningJob = null; try { runningJob = jobClientLocal.getJob(id); } catch (Exception e) { log.warn("Exception while querying job status for jobId=" + id +" message: " + e.getMessage()); log.debug(e); return; } if (runningJob == null) { log.warn("Couldn't find job status for jobId=" + id); return; } Properties jobConfProperties = getJobConfFromFile(runningJob); JobID jobID = null; try { jobID = runningJob.getID(); } catch (NullPointerException e) { log.warn("Couldn't get jobID for runningJob."); return; } TaskReport[] mapTaskReport = jobClientLocal.getMapTaskReports(jobID); TaskReport[] reduceTaskReport = jobClientLocal.getReduceTaskReports(jobID); if (jobConfProperties != null && jobConfProperties.size() > 0) { pigJob.setConfiguration(jobConfProperties); } pigJob.setMapReduceJobState( new MapReduceJobState(runningJob, mapTaskReport, reduceTaskReport)); } catch (IOException e) { log.warn("Error occurred when retrieving job progress info. ", e); } }
Source:
<code>private ExecutionList executionList() { <START> for (;;) { <END> ExecutionList executionListLocal = this.executionList; if (executionListLocal != null) { return executionListLocal; } ExecutionList r = new ExecutionList(); if (executionListField.compareAndSet(this, null, r)) { return r; } } }</code><technical_language>need this</technical_language>

Target:
private ExecutionList executionList() { ExecutionList executionListLocal = this.executionList; if (executionListLocal != null) { return executionListLocal; } ExecutionList r = new ExecutionList(); if (executionListField.compareAndSet(this, null, r)) { return r; } else { return this.executionList; } }
Source:
<code>public boolean visit(@Nonnull JSwitchStatement switchStmt) { JExpression switchExpr = switchStmt.getExpr(); JType switchExprType = switchExpr.getType(); if (switchExprType != null && switchExprType instanceof JDefinedEnum) { JDefinedEnum enumType = (JDefinedEnum) switchExprType; JDefinedClass syntheticSwitchmapClass = manager.getOrCreateRelatedSyntheticClass( enclosingClass, enumType); SyntheticSwitchmapClassFiller filler = new SyntheticSwitchmapClassFiller(); filler.fillSyntheticClass(supportUtil, enumType, syntheticSwitchmapClass); String syntheticInitializerName = SupportUtil.getSyntheticSwitchmapInitializerName( enumType); JMethod syntheticSwitchmapInitializer = syntheticSwitchmapClass.getMethod( syntheticInitializerName, supportUtil.getPrimitiveIntType().getArray()); <START> <END> JExpression callSwitchValues = new JMethodCall(switchStmt.getSourceInfo(), null, syntheticSwitchmapClass, syntheticSwitchmapInitializer.getMethodId(), supportUtil.getPrimitiveIntType().getArray(), syntheticSwitchmapInitializer.canBePolymorphic()); JMethodId ordinalMethodId = enumType.getOrCreateMethodId(SupportUtil.Ordinal, Collections.<JType>emptyList(), MethodKind.INSTANCE_VIRTUAL); transformRequest.append(new Replace(switchExpr, new JArrayRef(switchStmt.getSourceInfo(), callSwitchValues, new JMethodCall(switchStmt.getSourceInfo(), switchExpr, enumType, ordinalMethodId, supportUtil.getPrimitiveIntType(), ordinalMethodId.canBeVirtual()) ) ) ); } return super.visit(switchStmt); }</code><technical_language>This needs a generated code example</technical_language>

Target:
public boolean visit(@Nonnull JSwitchStatement switchStmt) { JExpression switchExpr = switchStmt.getExpr(); JType switchExprType = switchExpr.getType(); if (switchExprType instanceof JDefinedEnum) { JDefinedEnum enumType = (JDefinedEnum) switchExprType; JDefinedClass switchMapClass = manager.getOrCreateRelatedSyntheticClass(enumType); if (switchMapClass == null) { switchMapClass = enclosingClass; } SwitchMapClassFiller classFiller = new SwitchMapClassFiller(); classFiller.fillSwitchMapClass(supportUtil, enumType, switchMapClass); String syntheticInitializerName = SupportUtil.getSyntheticSwitchMapInitializerName( enumType); JMethod syntheticSwitchmapInitializer = switchMapClass.getMethod( syntheticInitializerName, supportUtil.getPrimitiveIntType().getArray()); JExpression getSwitchMapInvocExpr = new JMethodCall(switchStmt.getSourceInfo(), null , switchMapClass, syntheticSwitchmapInitializer.getMethodId(), syntheticSwitchmapInitializer.getType(), syntheticSwitchmapInitializer.canBePolymorphic()); JMethod ordinalMethod = supportUtil.getEnumType().getMethod(SupportUtil.Ordinal, supportUtil.getPrimitiveIntType(), Collections.<JType>emptyList()); transformRequest.append(new Replace(switchExpr, new JArrayRef(switchStmt.getSourceInfo(), getSwitchMapInvocExpr, new JMethodCall(switchStmt.getSourceInfo(), switchExpr, enumType, ordinalMethod.getMethodId(), ordinalMethod.getType(), ordinalMethod.canBePolymorphic()) ) ) ); } return super.visit(switchStmt); }
Source:
<code>public String toString() { <START> return String.format("UfsJournalSystem, based at %s", mBase.toString()); <END> }</code><technical_language>MoreObjects.toStringHelper() for this</technical_language>

Target:
public String toString() { return MoreObjects.toStringHelper(this) .add("Ufs-Uri", mBase) .toString(); }
Source:
<code>protected void taskExecute() { <START> if (log.isDebugEnabled()) { <END> log.debug("Executing RabbitMQ Task Execution."); } rabbitMQConsumer.execute(); }</code><technical_language>do need check if debug is enabled is string concatenation. check done internally</technical_language>

Target:
protected void taskExecute() { log.debug("Executing RabbitMQ Task Execution."); rabbitMQConsumer.execute(); }
Source:
<code>private void sendWork(List<LuceneWork> works, Address destination) { AffinityUpdateCommand indexUpdateCommand = new AffinityUpdateCommand(ByteString.fromString(cache.getName())); byte[] serializedModel = getSerializer().toSerializedModel(works); indexUpdateCommand.setSerializedWorkList(serializedModel); List<Address> dest = Collections.singletonList(destination); <START> log.infof("Sending work to %s to %s", works, dest); <END> CompletableFuture<Map<Address, Response>> result = rpcManager.invokeRemotelyAsync(dest, indexUpdateCommand, rpcManager.getDefaultRpcOptions(false)); result.whenComplete((responses, error) -> { if (error != null) { log.error("Error forwarding index job", error); } }); }</code><technical_language>Info? If need Log method</technical_language>

Target:
private void sendWork(List<LuceneWork> works, Address destination) { AffinityUpdateCommand indexUpdateCommand = new AffinityUpdateCommand(ByteString.fromString(cache.getName())); byte[] serializedModel = getSerializer().toSerializedModel(works); indexUpdateCommand.setSerializedWorkList(serializedModel); List<Address> dest = Collections.singletonList(destination); log.debugf("Sending works %s to %s", works, dest); CompletableFuture<Map<Address, Response>> result = rpcManager.invokeRemotelyAsync(dest, indexUpdateCommand, rpcManager.getDefaultRpcOptions(false)); result.whenComplete((responses, error) -> { if (error != null) { log.error("Error forwarding index job", error); } }); }
Source:
<code>public Term toKApp(List<Term> items) { <START> if(items.size()==0){ <END> return KApp.of(sort().unitLabel()); } Term basedKapp = items.get(items.size()-1); for(int i = items.size()-2; i >= 0; --i){ basedKapp = KApp.of(sort().constructorLabel(), items.get(i), basedKapp); } return basedKapp; }</code><technical_language>reason for saving spaces ==</technical_language>

Target:
public Term toKApp(List<Term> items) { if(items.isEmpty()){ return KApp.of(sort().unitLabel()); } Term current = items.get(items.size() - 1); for(int i = items.size() - 2; i >= 0; --i){ current = KApp.of(sort().constructorLabel(), items.get(i), current); } return current; }
Source:
<code>protected PageRec doCreatePage(IWorkbenchPart dummyPart) { DebuggerConsoleWorkbenchPart part = (DebuggerConsoleWorkbenchPart)dummyPart; IDebuggerConsole console = fPartToConsole.get(part); IPageBookViewPage page = console.createDebuggerPage(this); initPage(page); page.createControl(getPageBook()); console.addPropertyChangeListener(this); IConsolePageParticipant[] consoleParticipants = ((DebuggerConsoleManager)getConsoleManager()).getPageParticipants(console); final ListenerList<IConsolePageParticipant> participants = new ListenerList<>(); for (int i = 0; i < consoleParticipants.length; i++) { participants.add(consoleParticipants[i]); } fConsoleToPageParticipants.put(console, participants); for (IConsolePageParticipant iConsolePageParticipant : participants) { <START> final IConsolePageParticipant participant = iConsolePageParticipant; <END> SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { participant.init(page, console); } @Override public void handleException(Throwable exception) { CDebugUIPlugin.log(exception); participants.remove(participant); } }); } return new PageRec(dummyPart, page); }</code><technical_language>This extra variable unecessary. change for loop variable name 'participant' remove line</technical_language>

Target:
protected PageRec doCreatePage(IWorkbenchPart dummyPart) { DebuggerConsoleWorkbenchPart part = (DebuggerConsoleWorkbenchPart)dummyPart; IDebuggerConsole console = fPartToConsole.get(part); IPageBookViewPage page = console.createDebuggerPage(this); initPage(page); page.createControl(getPageBook()); console.addPropertyChangeListener(this); IConsolePageParticipant[] consoleParticipants = ((DebuggerConsoleManager)getConsoleManager()).getPageParticipants(console); final ListenerList<IConsolePageParticipant> participants = new ListenerList<>(); for (int i = 0; i < consoleParticipants.length; i++) { participants.add(consoleParticipants[i]); } fConsoleToPageParticipants.put(console, participants); for (IConsolePageParticipant participant : participants) { SafeRunner.run(new ISafeRunnable() { @Override public void run() throws Exception { participant.init(page, console); } @Override public void handleException(Throwable exception) { CDebugUIPlugin.log(exception); participants.remove(participant); } }); } return new PageRec(dummyPart, page); }
Source:
<code><START> @Override public boolean isPlayer() <END> { return false; }</code><technical_language>Fix formatter settings please disable :wink:</technical_language>

Target:
public boolean isPlayer() { return false; }
Source:
<code>void recordIoException(String serviceName, String hostname, int port) { try { hostMetrics.getUnchecked(ImmutableServiceHostAndPort.of(serviceName, hostname, port)).recordIoException(); } catch (Exception e) { log.warn("Unable to record IO exception for host and url", UnsafeArg.of("hostname", hostname), <START> UnsafeArg.of("url", port)); <END> } }</code><technical_language>s/urls/port/</technical_language>

Target:
void recordIoException(String serviceName, String hostname, int port) { try { hostMetrics.getUnchecked(ImmutableServiceHostAndPort.of(serviceName, hostname, port)).recordIoException(); } catch (Exception e) { log.warn("Unable to record IO exception for host and port", UnsafeArg.of("hostname", hostname), SafeArg.of("port", port)); } }
Source:
<code>public List<SymbolicValue> peekValues(int n) { if (n > stack.size()) { throw new IllegalStateException("At least " + n + " values were expected on the stack!"); } <START> final ArrayList<SymbolicValue> result = new ArrayList<>(stack); <END> return result.subList(0, n); }</code><technical_language>need a final local var, please Immutable List guava please build looping stack involves iterations constructing a new list slicing it</technical_language>

Target:
public List<SymbolicValue> peekValues(int n) { if (n > stack.size()) { throw new IllegalStateException("At least " + n + " values were expected on the stack!"); } return ImmutableList.copyOf(stack).subList(0, n); }
Source:
<code>public List<Failure> getFailures() { <START> return failures.stream().collect(Collectors.toList()); <END> }</code><technical_language>Please change this java return new ArrayList<>(failures);</technical_language>

Target:
public List<TestExecutionSummary.Failure> getFailures() { return new ArrayList<>(failures); }
Source:
<code><START> public SelectionWizardDescription createSelectionWizardDescription() { <END> SelectionWizardDescriptionImpl selectionWizardDescription = new SelectionWizardDescriptionImpl(); return selectionWizardDescription; }</code><technical_language>Lost @not-generated code</technical_language>

Target:
public SelectionWizardDescription createSelectionWizardDescription() { SelectionWizardDescriptionImpl selectionWizardDescription = new SelectionWizardDescriptionImpl(); ElementSelectVariable elementSelectVariable = this.createElementSelectVariable(); elementSelectVariable.setName("element"); ContainerViewVariable containerViewVariable = this.createContainerViewVariable(); containerViewVariable.setName("containerView"); SelectContainerVariable selectContainerVariable = this.createSelectContainerVariable(); selectContainerVariable.setName("container"); selectionWizardDescription.setElement(elementSelectVariable); selectionWizardDescription.setContainer(selectContainerVariable); selectionWizardDescription.setContainerView(containerViewVariable); InitialOperation initialOperation = this.createInitialOperation(); selectionWizardDescription.setInitialOperation(initialOperation); return selectionWizardDescription; }
Source:
<code>void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if (expectedReceiver instanceof MetaClass && expectedMethodName.equals("invokeMethod")) { return; } <START> if (expectedReceiver instanceof GroovyShell && expectedMethodName.equals("evaluate")) { <END> return; } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }</code><technical_language>Thanks for it</technical_language>

Target:
void checkMismatch(Object expectedReceiver, List<String> expectedMethodNames) { String expectedMethodName = expectedMethodNames.get(0); if (expectedReceiver instanceof MetaClass && expectedMethodName.equals("invokeMethod")) { return; } if(methodName.equals("methodMissing")){ return; } if (!expectedMethodNames.contains(methodName)) { MismatchHandler handler = handlers.get(); if (handler != null) { handler.handle(expectedReceiver, expectedMethodName, receiver, methodName); } } }
Source:
<code>public void ignore_other_resolutions() { <START> Multimap<String, NotificationChannel> recipients = HashMultimap.create(); <END> recipients.put("simon", emailChannel); recipients.put("freddy", twitterChannel); when(notifications.findSubscribedRecipientsForDispatcher(underTest, "struts")).thenReturn(recipients); Notification fixedNotif = new IssueChangeNotification().setFieldValue("projectKey", "struts") .setFieldValue("changeAuthor", "godin") .setFieldValue("new.resolution", Issue.RESOLUTION_FIXED) .setFieldValue("assignee", "freddy"); underTest.performDispatch(fixedNotif, context); verifyZeroInteractions(context); }</code><technical_language>lines 85 88 useless this test. resolution is supported, findSubscribedRecipientsForDispatcher is called (I verified locally)</technical_language>

Target:
public void ignore_other_resolutions() { Notification fixedNotif = new IssueChangeNotification().setFieldValue("projectKey", "struts") .setFieldValue("changeAuthor", "godin") .setFieldValue("new.resolution", Issue.RESOLUTION_FIXED) .setFieldValue("assignee", "freddy"); underTest.performDispatch(fixedNotif, context); verifyZeroInteractions(context); }
Source:
<code>public void loadXmlFromBase64(String responseStr) throws Exception { Base64 base64 = new Base64(); byte[] decodedB = base64.decode(responseStr); this.response = new String(decodedB); this.document = Utils.loadXML(this.response); if(this.document == null){ <START> <END> } }</code><technical_language>if statement inside</technical_language>

Target:
public void loadXmlFromBase64(String responseStr) throws Exception { Base64 base64 = new Base64(); byte[] decodedB = base64.decode(responseStr); this.response = new String(decodedB); this.document = Utils.loadXML(this.response); if(this.document == null){ throw new Exception("SAML Response could not be processed"); } }
Source:
<code><START> public static AbstractTopology updateTopologyToZK(ZooKeeper zk, AbstractTopology topology) { <END> try { Stat stat = new Stat(); zk.getData(VoltZK.topology, false, stat); byte[] payload = topology.topologyToJSON().toString().getBytes(Charsets.UTF_8); zk.setData(VoltZK.topology, payload, stat.getVersion()); return readTopologyFromZK(zk); } catch (Exception e) { VoltDB.crashLocalVoltDB("Unable to read topology from ZK, dying", true, e); } return topology; }</code><technical_language>Returned topology used, change return type void</technical_language>

Target:
public static void updateTopologyToZK(ZooKeeper zk, AbstractTopology topology) { Stat stat = new Stat(); try { zk.getData(VoltZK.topology, false, stat); byte[] payload = topology.topologyToJSON().toString().getBytes(Charsets.UTF_8); zk.setData(VoltZK.topology, payload, stat.getVersion()); } catch (KeeperException | InterruptedException | JSONException e) { VoltDB.crashLocalVoltDB("Unable to update topology to ZK, dying", true, e); } }
Source:
<code>public Status read( final String table, final String key, final Set<String> fields, final Map<String, ByteIterator> result) { try { final Response searchResponse = search(table, key); final int statusCode = searchResponse.getStatusLine().getStatusCode(); if (statusCode == 404) { return Status.NOT_FOUND; } else if (statusCode != 200) { return Status.ERROR; } final Map<String, Object> map = map(searchResponse); @SuppressWarnings("unchecked") final Map<String, Object> hits = (Map<String, Object>)map.get("hits"); final int total = (int)hits.get("total"); if (total == 0) { return Status.NOT_FOUND; } @SuppressWarnings("unchecked") final Map<String, Object> hit = (Map<String, Object>)((List<Object>)hits.get("hits")).get(0); @SuppressWarnings("unchecked") final Map<String, Object> source = (Map<String, Object>)hit.get("_source"); if (fields != null) { for (final String field : fields) { result.put(field, new StringByteIterator((String) source.get(field))); } } else { for (final Map.Entry<String, Object> e : source.entrySet()) { if (KEY.equals(e.getKey())) { continue; } result.put(e.getKey(), new StringByteIterator((String) e.getValue())); } } return Status.OK; } catch (final Exception e) { <START> e.printStackTrace(); <END> return Status.ERROR; } }</code><technical_language>Exception#printStackTrace stderr default</technical_language>

Target:
public Status read( final String table, final String key, final Set<String> fields, final Map<String, ByteIterator> result) { try { final Response searchResponse = search(table, key); final int statusCode = searchResponse.getStatusLine().getStatusCode(); if (statusCode == 404) { return Status.NOT_FOUND; } else if (statusCode != HttpStatus.SC_OK) { return Status.ERROR; } final Map<String, Object> map = map(searchResponse); @SuppressWarnings("unchecked") final Map<String, Object> hits = (Map<String, Object>)map.get("hits"); final int total = (int)hits.get("total"); if (total == 0) { return Status.NOT_FOUND; } @SuppressWarnings("unchecked") final Map<String, Object> hit = (Map<String, Object>)((List<Object>)hits.get("hits")).get(0); @SuppressWarnings("unchecked") final Map<String, Object> source = (Map<String, Object>)hit.get("_source"); if (fields != null) { for (final String field : fields) { result.put(field, new StringByteIterator((String) source.get(field))); } } else { for (final Map.Entry<String, Object> e : source.entrySet()) { if (KEY.equals(e.getKey())) { continue; } result.put(e.getKey(), new StringByteIterator((String) e.getValue())); } } return Status.OK; } catch (final Exception e) { e.printStackTrace(); return Status.ERROR; } }