auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void updateEvent(Event event, Position position) { <START> updateEvent(event, position, false); <END> }</code><technical_language>Is time position is null want update it? Possibly for this pull request, handling events in web app if event position in message</technical_language>

Target:
public void updateEvent(Event event, Position position) { try { dataManager.addObject(event); } catch (SQLException error) { Log.warning(error); } Set<Long> users = Context.getPermissionsManager().getDeviceUsers(event.getDeviceId()); for (long userId : users) { if (event.getGeofenceId() == 0 || Context.getGeofenceManager() != null && Context.getGeofenceManager().checkItemPermission(userId, event.getGeofenceId())) { Notification notification = getUserNotificationByType(userId, event.getType()); if (notification != null) { if (notification.getWeb()) { Context.getConnectionManager().updateEvent(userId, event); } if (notification.getMail()) { NotificationMail.sendMailAsync(userId, event, position); } if (notification.getSms()) { NotificationSms.sendSmsAsync(userId, event, position); } } } } if (Context.getEventForwarder() != null) { Context.getEventForwarder().forwardEvent(event, position); } }
Source:
<code>public void cancelCreateTableTest() throws SQLException { String sql = format("CREATE TABLE %s AS " + "SELECT orderkey, partkey, shipinstruct FROM tpch.sf1.lineitem", tableName); <START> <END> doCancelTest(sql); try { query(format("DROP TABLE %s", tableName)); throw new RuntimeException("cancelCreateTableTest failed"); } catch (QueryExecutionException exceptionDueToNonExistentTableName) { } }</code><technical_language>This is confusing clean code part of test (and clean get done dropTestTables()). I do assertion instead confirm table exist. assertThat(query(whatever query calls table)).failsWithMessage(...)</technical_language>

Target:
public void cancelCreateTableTest() throws Exception { String tableName = format("cancel_createtable_%s", randomUUID().toString().replace("-", "")); String sql = format("CREATE TABLE %s AS " + "SELECT * FROM tpch.sf1.lineitem", tableName); doCancelTest(sql); assertThat(() -> query(format("SELECT * from %s", tableName))) .failsWithMessage(format("Table hive.default.%s does not exist", tableName)); query(format("DROP TABLE IF EXISTS %s", tableName)); }
Source:
<code>public JolieServiceLoader( Expression channelDest, Interpreter currInterpreter, String servicePath ) throws IOException, CommandLineException { super( channelDest ); final String[] ss = servicePathSplitPattern.split( servicePath ); final String[] options = currInterpreter.optionArgs(); final String[] newArgs = new String[ 2 + options.length + ss.length ]; newArgs[ 0 ] = "-i"; newArgs[ 1 ] = currInterpreter.programDirectory().getAbsolutePath(); newArgs[ 2 ] = "--serviceIdentifier"; <START> newArgs[ 3 ] = new Long( Interpreter.getServiceIdentifier() ).toString(); <END> System.arraycopy( options, 0, newArgs, 2, options.length ); System.arraycopy( ss, 0, newArgs, 2 + options.length, ss.length ); CommandLineParser commandLineParser = new CommandLineParser( newArgs, currInterpreter.getClassLoader(), false ); InterpreterParameters interpreterParameters = commandLineParser.getInterpreterParameters(); interpreter = new Interpreter( currInterpreter.getClassLoader(), commandLineParser.getInterpreterParameters(), currInterpreter.programDirectory() ); }</code><technical_language>Long.valueOf</technical_language>

Target:
public JolieServiceLoader( Expression channelDest, Interpreter currInterpreter, String servicePath ) throws IOException, CommandLineException { super( channelDest ); final String[] ss = SERVICE_PATH_SPLIT_PATTERN.split( servicePath ); final String[] options = currInterpreter.optionArgs(); final String[] newArgs = new String[ 2 + options.length + ss.length ]; newArgs[ 0 ] = "-i"; newArgs[ 1 ] = currInterpreter.programDirectory().getAbsolutePath(); System.arraycopy( options, 0, newArgs, 2, options.length ); System.arraycopy( ss, 0, newArgs, 2 + options.length, ss.length ); CommandLineParser commandLineParser = new CommandLineParser( newArgs, currInterpreter.getClassLoader(), false ); interpreter = new Interpreter( currInterpreter.getClassLoader(), commandLineParser.getInterpreterParameters(), currInterpreter.programDirectory() ); }
Source:
<code>private boolean validateNetworkInterfaces() { Map<String,VmNetworkInterface> interfaceNetworkMap = Entities.interfacesByNetworkName(getVm().getInterfaces()); Set<String> interfaceNetworkNames = interfaceNetworkMap.keySet(); List<network> clusterNetworks = DbFacade.getInstance() <START> .getNetworkDAO() <END> .getAllForCluster(getVm().getvds_group_id()); return isVmInterfacesConfigured(interfaceNetworkMap) && isVmInterfacesAttachedToClusterNetworks(clusterNetworks, interfaceNetworkNames) && isVmInterfacesAttachedToVmNetworks(clusterNetworks, interfaceNetworkNames); }</code><technical_language>please refactor DAO call AuditLogable base: DbFacade.getInstance().getNetworkDAO() --> getNetworkDao() - ease testing</technical_language>

Target:
private boolean validateNetworkInterfaces() { Map<String,VmNetworkInterface> interfaceNetworkMap = Entities.interfacesByNetworkName(getVm().getInterfaces()); Set<String> interfaceNetworkNames = interfaceNetworkMap.keySet(); List<network> clusterNetworks = getNetworkDAO().getAllForCluster(getVm().getvds_group_id()); Set<String> clusterNetworksNames = Entities.objectNames(clusterNetworks); return isVmInterfacesConfigured(interfaceNetworkMap) && isVmInterfacesAttachedToClusterNetworks(clusterNetworksNames, interfaceNetworkNames) && isVmInterfacesAttachedToVmNetworks(clusterNetworks, interfaceNetworkNames); }
Source:
<code><START> public static ArrayList<Guid> getGuidListFromString(String str) { <END> if (str == null || str.isEmpty()) { return new ArrayList<Guid>(); } return getGuidListFromStringArray(Arrays.asList(str.split(SEPARATOR))); }</code><technical_language>org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty(String)</technical_language>

Target:
public static ArrayList<Guid> getGuidListFromString(String str) { if (StringHelper.isNullOrEmpty(str)) { return new ArrayList<Guid>(); } return getGuidListFromStringArray(Arrays.asList(str.split(SEPARATOR))); }
Source:
<code>private void deleteGraphicalSynapseConfigFiles(IProject project) throws CoreException { IResource[] projectResources = project.members(); <START> if (projectResources != null) { <END> for (IResource projectResource : projectResources) { if (projectResource instanceof IFile) { if (ESB_FILE_EXTENSION.equals(projectResource.getFileExtension()) || ESB_DIAGRAM_FILE_EXTENSION.equals(projectResource.getFileExtension())) { projectResource.delete(true, new NullProgressMonitor()); } } } } }</code><technical_language>is needed check for null here</technical_language>

Target:
private void deleteGraphicalSynapseConfigFiles(IProject project) throws CoreException { IResource[] projectResources = project.members(); for (IResource projectResource : projectResources) { if (projectResource instanceof IFile && (ESB_FILE_EXTENSION.equals(projectResource.getFileExtension()) || ESB_DIAGRAM_FILE_EXTENSION .equals(projectResource.getFileExtension()))) { projectResource.delete(true, new NullProgressMonitor()); } } }
Source:
<code>public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { final File layerPath = getLayerPath(layerName); if (!layerPath.exists() || !layerPath.canWrite()) { log.info(layerPath + " does not exist or is not writable"); return false; } <START> File[] parameterCaches = layerPath.listFiles(new FileFilter() { <END> public boolean accept(File pathname) { if (!pathname.isDirectory()) { return false; } String dirName = pathname.getName(); return dirName.endsWith(parametersId); } }); for (File parameterCache : parameterCaches) { String target = filteredLayerName(layerName) + "_" + parameterCache.getName(); stageDelete(parameterCache, target); } listeners.sendParametersDeleted(layerName, parametersId); return true; }</code><technical_language>FileFilter is functional, a lambda (just observation, a request for change)</technical_language>

Target:
public boolean deleteByParametersId(String layerName, String parametersId) throws StorageException { final File layerPath = getLayerPath(layerName); if (!layerPath.exists() || !layerPath.canWrite()) { log.info(layerPath + " does not exist or is not writable"); return false; } File[] parameterCaches = layerPath.listFiles((pathname)-> { if (!pathname.isDirectory()) { return false; } String dirName = pathname.getName(); return dirName.endsWith(parametersId); }); for (File parameterCache : parameterCaches) { String target = filteredLayerName(layerName) + "_" + parameterCache.getName(); stageDelete(parameterCache, target); } listeners.sendParametersDeleted(layerName, parametersId); return true; }
Source:
<code>private void startInvocation( IInvocationContext context, ExecutableCommand cmd, IScheduledInvocationListener... listeners) { initInvocation(); throwIfDeviceInInvocationThread(context.getDevices()); int invocationId = cmd.getCommandTracker().getId(); CLog.d("starting invocation for command id %d", invocationId); final String invocationName = String.format("Invocation-%s", context.getSerials().get(0)); InvocationThread invocationThread = new InvocationThread(invocationName, context, cmd, listeners); if (context instanceof InvocationContext) { ((InvocationContext) <START> context).setInvocationId(invocationId); <END> } logInvocationStartedEvent(cmd.getCommandTracker(), context); invocationThread.start(); addInvocationThread(invocationThread); }</code><technical_language>add attribute instead</technical_language>

Target:
private void startInvocation( IInvocationContext context, ExecutableCommand cmd, IScheduledInvocationListener... listeners) { initInvocation(); throwIfDeviceInInvocationThread(context.getDevices()); int invocationId = cmd.getCommandTracker().getId(); CLog.d("starting invocation for command id %d", invocationId); final String invocationName = String.format("Invocation-%s", context.getSerials().get(0)); InvocationThread invocationThread = new InvocationThread(invocationName, context, cmd, listeners); context.addInvocationAttribute( IInvocationContext.INVOCATION_ID, Integer.toString(invocationId)); logInvocationStartedEvent(cmd.getCommandTracker(), context); invocationThread.start(); addInvocationThread(invocationThread); }
Source:
<code>public Map<Long, Object> getBlock(final String dataType, final int blockId) { final Map<Integer, Block> blocks = typeToBlocks.get(dataType); if (null == blocks) { LOG.log(Level.WARNING, "Data in type {0} has never been stored. The result is empty", dataType); return Collections.emptyMap(); } <START> final Block block = typeToBlocks.get(dataType).get(blockId); <END> if (null == block) { LOG.log(Level.WARNING, "Block with id {0} does not exist.", blockId); return Collections.emptyMap(); } return block.getAll(); }</code><technical_language>blocks in L167</technical_language>

Target:
public Map<Long, Object> getBlock(final String dataType, final int blockId) { final Map<Integer, Block> blocks = typeToBlocks.get(dataType); if (null == blocks) { LOG.log(Level.WARNING, "Data in type {0} has never been stored. The result is empty", dataType); return Collections.emptyMap(); } final Block block = blocks.get(blockId); if (null == block) { LOG.log(Level.WARNING, "Block with id {0} does not exist.", blockId); return Collections.emptyMap(); } return block.getAll(); }
Source:
<code>public byte[] getCacheKey() { <START> return new byte[]{CACHE_TYPE_ID}; <END> }</code><technical_language>need add more information dimension/index/length</technical_language>

Target:
public byte[] getCacheKey() { return ByteBuffer.allocate(1 + 8) .put(CACHE_TYPE_ID) .putInt(this.index) .putInt(this.end) .array(); }
Source:
<code>public <TYPE> TYPE followLink(TYPE object) { if (!isLink(object)) { throw new Error("Can't follow link because object don't have any"); } try { String href = ((Identified) object).href(); if (href == null) { throw new Error("Can't follow link because the 'href' attribute does't have a value"); } URL url = new URL(getUrl()); String prefix = url.getPath(); if (!prefix.endsWith("/")) { prefix += "/"; } if (!href.startsWith(prefix)) { throw new Error("The URL '" + href + "' isn't compatible with the base URL of the connection"); } String path = href.substring(prefix.length()); Service service = systemService().service(path); Method get = service.getClass().getMethod("get"); Object getRequest = get.invoke(service); Method send = getRequest.getClass().getMethod("send"); send.setAccessible(true); Object getResponse = send.invoke(getRequest); Method obtainObject = getResponse.getClass().getDeclaredMethods()[0]; obtainObject.setAccessible(true); return (TYPE) obtainObject.invoke(getResponse); } catch (NoSuchMethodException ex) { <START> throw new Error(ex); <END> } catch (IllegalAccessException ex) { throw new Error(ex); } catch (InvocationTargetException ex) { throw new Error(ex); } catch (MalformedURLException ex) { throw new Error(ex); } }</code><technical_language>add a meaningful message here, in a patch: Unexpected error while link "the_link" for other errors below</technical_language>

Target:
public <TYPE> TYPE followLink(TYPE object) { if (!isLink(object)) { throw new Error("Can't follow link because object don't have any"); } String href = ((Identified) object).href(); if (href == null) { throw new Error("Can't follow link because the 'href' attribute does't have a value"); } try { URL url = new URL(getUrl()); String prefix = url.getPath(); if (!prefix.endsWith("/")) { prefix += "/"; } if (!href.startsWith(prefix)) { throw new Error("The URL '" + href + "' isn't compatible with the base URL of the connection"); } String path = href.substring(prefix.length()); Service service = systemService().service(path); Method get = service.getClass().getMethod("get"); Object getRequest = get.invoke(service); Method send = getRequest.getClass().getMethod("send"); send.setAccessible(true); Object getResponse = send.invoke(getRequest); Method obtainObject = getResponse.getClass().getDeclaredMethods()[0]; obtainObject.setAccessible(true); return (TYPE) obtainObject.invoke(getResponse); } catch (NoSuchMethodException ex) { throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex); } catch (IllegalAccessException ex) { throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex); } catch (InvocationTargetException ex) { throw new Error(String.format("Unexpected error while following link \"%1$s\"", href), ex); } catch (MalformedURLException ex) { throw new Error(String.format("Error while creating URL \"%1$s\"", getUrl()), ex); } }
Source:
<code>public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) { MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer(); Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas(); FailureCollector collector = pipelineConfigurer.getMultiInputStageConfigurer().getFailureCollector(); init(inputSchemas, collector); collector.getOrThrowException(); <START> Schema outputSchema = getOutputSchema(inputSchemas, collector); <END> if (outputSchema.getFields() != null && !outputSchema.getFields().isEmpty()) { stageConfigurer.setOutputSchema(outputSchema); } }</code><technical_language>getOutputSchema handle null join keys other configs</technical_language>

Target:
public void configurePipeline(MultiInputPipelineConfigurer pipelineConfigurer) { MultiInputStageConfigurer stageConfigurer = pipelineConfigurer.getMultiInputStageConfigurer(); Map<String, Schema> inputSchemas = stageConfigurer.getInputSchemas(); FailureCollector collector = pipelineConfigurer.getMultiInputStageConfigurer().getFailureCollector(); init(inputSchemas, collector); collector.getOrThrowException(); Schema outputSchema = getOutputSchema(inputSchemas, collector); if (outputSchema != null) { stageConfigurer.setOutputSchema(outputSchema); } }
Source:
<code>private void setSubtreeChecked(Object element, boolean checked) { <START> fCheckboxTreeViewer.setChecked(element, checked); <END> if (checked) { fCheckboxTreeViewer.setGrayed(element, false); } fCheckboxTreeViewer.setChecked(element, checked); Object[] children = fContentProvider.getChildren(element); if (children != null) { for (Object child : children) { setSubtreeChecked(child, checked); } } }</code><technical_language>Redundant if</technical_language>

Target:
private void setSubtreeChecked(Object element, boolean checked) { fCheckboxTreeViewer.setChecked(element, checked); if (checked) { fCheckboxTreeViewer.setGrayed(element, false); } Object[] children = fContentProvider.getChildren(element); if (children != null) { for (Object child : children) { setSubtreeChecked(child, checked); } } }
Source:
<code>private void createCourseRelatedButtons(InstructorAttributes currentInstructor) { boolean isEditDeleteButtonDisabled = !currentInstructor.isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); editCourseButton = createEditCourseButton(isEditDeleteButtonDisabled); deleteCourseButton = createDeleteCourseButton(isEditDeleteButtonDisabled); <START> boolean isAddButtonDisabled = !currentInstructor.isAllowedForPrivilege( <END> Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR); addInstructorButton = createAddInstructorButton(isAddButtonDisabled); }</code><technical_language>isAddInstructorButtonDisabled isAddButtonDisabled object add</technical_language>

Target:
private void createCourseRelatedButtons(InstructorAttributes currentInstructor) { boolean isEditDeleteCourseButtonDisabled = !currentInstructor.isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE); editCourseButton = createEditCourseButton(isEditDeleteCourseButtonDisabled); deleteCourseButton = createDeleteCourseButton(isEditDeleteCourseButtonDisabled); boolean isAddInstructorButtonDisabled = !currentInstructor.isAllowedForPrivilege( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR); addInstructorButton = createAddInstructorButton(isAddInstructorButtonDisabled); }
Source:
<code>private String getTemplateDirectory(String template) { String templateDirectoryName; switch (infrastructure) { case openshift: case k8s: <START> templateDirectoryName = Infrastructure.openshift.toString().toLowerCase(); <END> break; case docker: default: templateDirectoryName = infrastructure.toString().toLowerCase(); } return String.format("/templates/workspace/%s/%s", templateDirectoryName, template); }</code><technical_language>Is OK case is "k8s" infrastructure is "openshift"</technical_language>

Target:
private String getTemplateDirectory(String template) { String templateDirectoryName; switch (infrastructure) { case OSIO: case K8S: templateDirectoryName = Infrastructure.OPENSHIFT.toString().toLowerCase(); break; default: templateDirectoryName = infrastructure.toString().toLowerCase(); } return String.format("/templates/workspace/%s/%s", templateDirectoryName, template); }
Source:
<code>public void assignChildElement(Object parent, String nodeName, Object child) { ExtensionElements id = (ExtensionElements) parent; <START> if (nodeName.equals(DMN_EXTERNAL_LINK)) { <END> id.getExternalLinks().add((DMNExternalLink) child); } else { id.getAny().add(child); } }</code><technical_language>please Objects.equals</technical_language>

Target:
public void assignChildElement(Object parent, String nodeName, Object child) { ExtensionElements id = (ExtensionElements) parent; if (Objects.equals(nodeName, DMN_EXTERNAL_LINK)) { id.getExternalLinks().add((DMNExternalLink) child); } else { id.getAny().add(child); } }
Source:
<code>private WildcardPattern[] getExclusionPatterns() { if (exclusionPatterns == null) { if (StringUtils.isEmpty(exclusion)) { <START> return new WildcardPattern[0]; <END> } exclusionPatterns = PatternUtils.createPatterns(exclusion); } return exclusionPatterns; }</code><technical_language>lazily initialize exclusionPatterns empty array exclusion is provided, slightly improve performance calling rule multiple files analysis</technical_language>

Target:
private WildcardPattern[] getExclusionPatterns() { if (exclusionPatterns == null) { if (StringUtils.isEmpty(exclusion)) { exclusionPatterns = new WildcardPattern[0]; } else { exclusionPatterns = PatternUtils.createPatterns(exclusion); } } return exclusionPatterns; }
Source:
<code>public void commit(Xid xid, boolean b) throws XAException { <START> assertIfRecoveryScanWasStarted(); <END> delegate.commit(xid, b); }</code><technical_language>RMERR out of this is good - check spec</technical_language>

Target:
public void commit(Xid xid, boolean b) throws XAException { delegate.commit(xid, b); }
Source:
<code>private void initSqlTypes() { <START> sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); <END> sqlTypes.put("DIMMERITEM", "SMALLINT"); sqlTypes.put("ROLLERSHUTTERITEM", "SMALLINT"); sqlTypes.put("STRINGITEM", "VARCHAR(32000)"); sqlTypes.put("TABLEPRIMARYVALUE", "CURRENT_TIMESTAMP"); logger.debug("JDBC::initEtendedSqlTypes: Initialize the type array sqlTypes={}", sqlTypes.values()); }</code><technical_language>earlier question</technical_language>

Target:
private void initSqlTypes() { sqlTypes.put("DATETIMEITEM", "TIMESTAMP"); sqlTypes.put("DIMMERITEM", "SMALLINT"); sqlTypes.put("ROLLERSHUTTERITEM", "SMALLINT"); sqlTypes.put("STRINGITEM", "VARCHAR(32000)"); sqlTypes.put("tablePrimaryValue", "CURRENT_TIMESTAMP"); logger.debug("JDBC::initEtendedSqlTypes: Initialize the type array sqlTypes={}", sqlTypes.values()); }
Source:
<code>public boolean isSnapshotExist(final Guid id) { return execute(new Callable<Boolean>() { @Override public Boolean call() { try { Snapshot snapshot = proxy.getSnapshotById(id.toString()); return snapshot != null; } catch (OpenStackResponseException ex) { if <START> (ex.getStatus() <END> == HttpStatus.SC_NOT_FOUND) { return false; } throw ex; } } }); }</code><technical_language>worth adding a log here.</technical_language>

Target:
public boolean isSnapshotExist(final Guid id) { return execute(new Callable<Boolean>() { @Override public Boolean call() { try { Snapshot snapshot = proxy.getSnapshotById(id.toString()); return snapshot != null; } catch (OpenStackResponseException ex) { if (ex.getStatus() == HttpStatus.SC_NOT_FOUND) { log.info("Snapshot does not exists"); return false; } else { log.error("An error has occurred while looking for snapshot."); throw ex; } } } }); }
Source:
<code>private String getBody() { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; List<TaskState> tasks = jobState.getTasks(); <START> StringBuilder taskStatus = new StringBuilder(); <END> for (TaskState task : tasks) { taskStatus.append(task.getId().getReadableName() + " (" + task.getId().toString() + ") Status: " + task.getStatus().toString() + "\n"); } try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } return String.format(BODY_TEMPLATE, jobID, status, taskStatus.toString(), hostname); }</code><technical_language>rename variable e.g. allTaskStatusesString</technical_language>

Target:
private String getBody() { String jobID = jobState.getId().value(); String status = jobState.getStatus().toString(); String hostname = "UNKNOWN"; List<TaskState> tasks = jobState.getTasks(); String allTaskStatusesString = String.join(System.lineSeparator(), tasks.stream() .map(task -> task.getId().getReadableName() + " (" + task.getId().toString() + ") Status: " + task.getStatus().toString()) .collect(Collectors.toList())); try { hostname = InetAddress.getLocalHost().getCanonicalHostName(); } catch (UnknownHostException e) { logger.debug("Could not get hostname", e); } return String.format(BODY_TEMPLATE, jobID, status, allTaskStatusesString, hostname); }
Source:
<code>public void orderMethods(MethodOrdererContext context) { Map<String, String[]> digraph = context.getMethodDescriptors().stream().filter( descriptor -> descriptor.isAnnotated(DependsOn.class)).collect( toMap(descriptor -> descriptor.getMethod().getName(), descriptor -> descriptor.findAnnotation(DependsOn.class).map(DependsOn::value).get())); Map<String, Integer> dependencySize = new HashMap<>(); try { <START> digraph.keySet().forEach(name -> { <END> if (!dependencySize.containsKey(name)) { depthFirstSearch(name, digraph, dependencySize); } }); } catch (IllegalArgumentException exception) { logger.error(exception, () -> "ERROR - Some arguments from @DependsOn annotations form cyclic dependencies, which would cause undefined behavior!"); } context.getMethodDescriptors().sort( Comparator.comparing(descriptor -> dependencySize.getOrDefault(descriptor.getMethod().getName(), 0))); }</code><technical_language>replace this one-liner. java digraph.keySet().forEach(name -> depthFirstSearch(name, digraph, dependencySize));</technical_language>

Target:
public void orderMethods(MethodOrdererContext context) { Map<String, String[]> digraph = context.getMethodDescriptors().stream().filter( descriptor -> descriptor.isAnnotated(DependsOn.class)).collect( toMap(descriptor -> descriptor.getMethod().getName(), descriptor -> descriptor.findAnnotation(DependsOn.class).map(DependsOn::value).get())); Map<String, Integer> dependencySize = new HashMap<>(); try { digraph.keySet().forEach(name -> depthFirstSearch(name, digraph, dependencySize)); } catch (IllegalArgumentException exception) { logger.error(exception, () -> "ERROR - Some arguments from @DependsOn annotations form cyclic dependencies, which would cause undefined behavior!"); } context.getMethodDescriptors().sort( Comparator.comparing(descriptor -> dependencySize.getOrDefault(descriptor.getMethod().getName(), INDEPENDENT_TEST_PRIORITY))); }
Source:
<code>public ArrayList<ElementTag> getFeedbackSessionTypeOptions(String defaultSessionType) { ArrayList<ElementTag> result = new ArrayList<ElementTag>(); ElementTag standardFeedbackSession = createOption("Session with your own questions", "STANDARD", defaultSessionType == null || <START> defaultSessionType.equals("TEAMEVALUATION")); <END> ElementTag evaluationFeedbackSession = createOption("Team peer evaluation session", "TEAMEVALUATION", defaultSessionType == null || defaultSessionType.equals("TEAMEVALUATION")); result.add(standardFeedbackSession); result.add(evaluationFeedbackSession); return result; }</code><technical_language>boolean condition is connected, want put a single line. Also, operators start of new lines, end of previous</technical_language>

Target:
private ArrayList<ElementTag> getFeedbackSessionTypeOptions(String defaultSessionType) { ArrayList<ElementTag> result = new ArrayList<ElementTag>(); ElementTag standardFeedbackSession = createOption("Session with your own questions", "STANDARD", defaultSessionType != null && defaultSessionType.equals("STANDARD")); ElementTag evaluationFeedbackSession = createOption("Team peer evaluation session", "TEAMEVALUATION", defaultSessionType == null || defaultSessionType.equals("TEAMEVALUATION")); result.add(standardFeedbackSession); result.add(evaluationFeedbackSession); return result; }
Source:
<code>public void visitVariableExpression(final VariableExpression exp) { Variable ref = exp.getAccessedVariable(); if (ref instanceof VariableExpression || ref instanceof Parameter) { makeNode("localVariable", new Runnable() { @Override public void run() { loc(exp); literal(exp.getName()); } }); } else if (ref instanceof DynamicVariable || ref instanceof PropertyNode || ref instanceof FieldNode) { if (ref instanceof FieldNode && classNode.getGetterMethod("get" + Verifier.capitalize(exp.getName())) != null) { makeNode("attribute", new Runnable() { @Override public void run() { loc(exp); makeNode("javaThis_"); visit(new ConstantExpression(exp.getName())); literal(false); } }); } else { makeNode("property", new Runnable() { @Override public void run() { loc(exp); makeNode("javaThis_"); literal(exp.getName()); } }); } } else if ("this".equals(exp.getName())) { makeNode("this_"); } else if ("super".equals(exp.getName())) { makeNode("super_", new Runnable() { @Override public void run() { literal(classNode); } }); } else { <START> System.err.println("V: " + exp); <END> sourceUnit.addError(new SyntaxException("Unsupported expression for CPS transformation", exp.getLineNumber(), exp.getColumnNumber())); } }</code><technical_language>delete</technical_language>

Target:
public void visitVariableExpression(final VariableExpression exp) { Variable ref = exp.getAccessedVariable(); if (ref instanceof VariableExpression || ref instanceof Parameter) { makeNode("localVariable", new Runnable() { @Override public void run() { loc(exp); literal(exp.getName()); } }); } else if (ref instanceof DynamicVariable || ref instanceof PropertyNode || ref instanceof FieldNode) { if (ref instanceof FieldNode && classNode.getGetterMethod("get" + Verifier.capitalize(exp.getName())) != null) { makeNode("attribute", new Runnable() { @Override public void run() { loc(exp); makeNode("javaThis_"); visit(new ConstantExpression(exp.getName())); literal(false); } }); } else { makeNode("property", new Runnable() { @Override public void run() { loc(exp); makeNode("javaThis_"); literal(exp.getName()); } }); } } else if ("this".equals(exp.getName())) { makeNode("this_"); } else if ("super".equals(exp.getName())) { makeNode("super_", new Runnable() { @Override public void run() { literal(classNode); } }); } else { sourceUnit.addError(new SyntaxException("Unsupported expression for CPS transformation", exp.getLineNumber(), exp.getColumnNumber())); } }
Source:
<code>public BufferCachingGrpcDataReader create() throws IOException { AlluxioConfiguration alluxioConf = mContext.getClusterConf(); int readerBufferSizeMessages = alluxioConf .getInt(PropertyKey.USER_STREAMING_READER_BUFFER_SIZE_MESSAGES); long dataTimeoutMs = alluxioConf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT); CloseableResource<BlockWorkerClient> client = mContext.acquireBlockWorkerClient(mAddress); GrpcBlockingStream<ReadRequest, ReadResponse> stream; try { String desc = "BufferCachingGrpcDataReader"; if (LOG.isDebugEnabled()) { desc = MoreObjects.toStringHelper(this) .add("request", mReadRequest) .add("address", mAddress) .toString(); } stream = new GrpcBlockingStream<>(client.get()::readBlock, readerBufferSizeMessages, desc); stream.send(mReadRequest, dataTimeoutMs); } catch (Exception e) { <START> client.close(); <END> throw e; } return new BufferCachingGrpcDataReader(mAddress, client, dataTimeoutMs, mReadRequest, stream); }</code><technical_language>do need close stream too</technical_language>

Target:
public BufferCachingGrpcDataReader create() throws IOException { AlluxioConfiguration alluxioConf = mContext.getClusterConf(); int readerBufferSizeMessages = alluxioConf .getInt(PropertyKey.USER_STREAMING_READER_BUFFER_SIZE_MESSAGES); long dataTimeoutMs = alluxioConf.getMs(PropertyKey.USER_STREAMING_DATA_TIMEOUT); CloseableResource<BlockWorkerClient> client = mContext.acquireBlockWorkerClient(mAddress); String desc = "BufferCachingGrpcDataReader"; if (LOG.isDebugEnabled()) { desc = MoreObjects.toStringHelper(this) .add("request", mReadRequest) .add("address", mAddress) .toString(); } GrpcBlockingStream<ReadRequest, ReadResponse> stream = null; try { stream = new GrpcBlockingStream<>(client.get()::readBlock, readerBufferSizeMessages, desc); stream.send(mReadRequest, dataTimeoutMs); } catch (Exception e) { if (stream != null) { stream.close(); } client.close(); throw e; } return new BufferCachingGrpcDataReader(mAddress, client, dataTimeoutMs, mReadRequest, stream); }
Source:
<code>public boolean isSuccessful() { <START> return true; <END> }</code><technical_language>if entry is present, command is successful</technical_language>

Target:
public boolean isSuccessful() { return successful; }
Source:
<code>private void initializeGitChangeWatcher() { requestTransmitter.newRequest() .endpointId("ws-agent") <START> .methodName("track:git-change") <END> .noParams() .sendAndSkipResult(); }</code><technical_language>please, rename method "track/git-change" (this is internal agreement)</technical_language>

Target:
private void initializeGitChangeWatcher() { requestTransmitter.newRequest() .endpointId("ws-agent") .methodName("track/git-change") .noParams() .sendAndSkipResult(); }
Source:
<code>private List<String> listTables(Server server) throws MojoExecutionException { String uri = server.getDbUri(); uri = uri.substring(0, uri.lastIndexOf("/")); DBConnector connector = null; final int tableNameColumnIndex = 3; try { connector = new DBConnector(uri, server.getDbUser(), server.getDbPassword(), server.getDbName()); DatabaseMetaData md = connector.getConnection().getMetaData(); ResultSet rs = md.getTables(server.getDbName(), null, null,new String[] {"TABLE"}); List<String> tableList = new ArrayList<>(); while (rs.next()) { tableList.add(rs.getString(tableNameColumnIndex)); } return tableList; } catch (SQLException e) { <START> return null; <END> } finally { if (connector != null){ try { connector.close(); } catch (SQLException e) { getLog().error(e.getMessage()); } } } }</code><technical_language>ignore exception return null</technical_language>

Target:
private List<String> listTables(Server server) throws MojoExecutionException { String uri = server.getDbUri(); uri = uri.substring(0, uri.lastIndexOf("/")); DBConnector connector = null; final int tableNameColumnIndex = 3; try { connector = new DBConnector(uri, server.getDbUser(), server.getDbPassword(), server.getDbName()); DatabaseMetaData md = connector.getConnection().getMetaData(); ResultSet rs = md.getTables(server.getDbName(), null, null,new String[] {"TABLE"}); List<String> tableList = new ArrayList<>(); while (rs.next()) { tableList.add(rs.getString(tableNameColumnIndex)); } return tableList; } catch (SQLException e) { throw new IllegalStateException("Failed to fetch table list from \"" + server.getDbName() + "\" database."); } finally { if (connector != null){ try { connector.close(); } catch (SQLException e) { getLog().error(e.getMessage()); } } } }
Source:
<code>private boolean externalNetworkValid(AddNetworkValidator validator) { ProviderValidator providerValidator = new ProviderValidator(providerDao.get(getNetwork().getProvidedBy().getProviderId())); return validate(providerValidator.providerIsSet()) && validate(validator.externalNetworkNewInDataCenter()) && validate(validator.externalNetworkIsVmNetwork()) && validate(validator.externalNetworkVlanValid()) && <START> (!getNetwork().isSetProviderPhysicalNetworkId() || validate(validator.providerPhysicalNetworkInDataCenter())); <END> }</code><technical_language>more consistent conceptually if this test a single call like: validator.physicalNetworkProviderIsValid()</technical_language>

Target:
private boolean externalNetworkValid(AddNetworkValidator validator) { ProviderValidator providerValidator = new ProviderValidator(providerDao.get(getNetwork().getProvidedBy().getProviderId())); return validate(providerValidator.providerIsSet()) && validate(validator.externalNetworkNewInDataCenter()) && validate(validator.externalNetworkIsVmNetwork()) && validate(validator.externalNetworkVlanValid()) && (!getNetwork().getProvidedBy().isSetPhysicalNetworkId() || providerPhysicalNetworkValid(validator)); }
Source:
<code>public void onRunFinish(boolean succeeded, BatchSourceContext context) { if (!succeeded && table != null && USE_TIMEFILTER.equals(config.fileRegex)) { String lastTimeRead = Bytes.toString(table.read(LAST_TIME_READ)); List<Date> existing = ImmutableList.of(); if (lastTimeRead != null) { existing = GSON.fromJson(lastTimeRead, ARRAYLIST_DATE_TYPE); } List<Date> failed = GSON.fromJson(datesToRead, ARRAYLIST_DATE_TYPE); failed.add(prevHour); failed.addAll(existing); table.write(LAST_TIME_READ, GSON.toJson(failed, ARRAYLIST_DATE_TYPE)); } try { if (fs.exists(path)) { fs.delete(path, true); } } catch (IOException e) { <START> throw new IllegalArgumentException("Error deleting temporary file."); <END> } }</code><technical_language>include message original IOException here</technical_language>

Target:
public void onRunFinish(boolean succeeded, BatchSourceContext context) { if (!succeeded && table != null && USE_TIMEFILTER.equals(config.fileRegex)) { String lastTimeRead = Bytes.toString(table.read(LAST_TIME_READ)); List<Date> existing = ImmutableList.of(); if (lastTimeRead != null) { existing = GSON.fromJson(lastTimeRead, ARRAYLIST_DATE_TYPE); } List<Date> failed = GSON.fromJson(datesToRead, ARRAYLIST_DATE_TYPE); failed.add(prevHour); failed.addAll(existing); table.write(LAST_TIME_READ, GSON.toJson(failed, ARRAYLIST_DATE_TYPE)); } try { if (path != null && fs.exists(path.getParent())) { fs.delete(path.getParent(), true); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Error deleting temporary file. %s.", e.getMessage()), e); } }
Source:
<code>public Storable remove(StorableKey key) { final Future<Storable> future = executorService.submit(new DeleteCallable(key)); Storable result = null; try { <START> result = future.get(); <END> } catch (InterruptedException|ExecutionException e) { throw new StorageException(e); } return result; }</code><technical_language>reason for making this sync only? return a Future<Storable> here</technical_language>

Target:
public Object remove(StorableKey key) { return executorService.submit(new DeleteCallable(key)); }
Source:
<code>public List<XYSeriesConsumer> getSeries() { <START> return checkNotNull(ImmutableList.copyOf(fSeries)); <END> }</code><technical_language>if copy is done constructor field is immutable list, expose list here</technical_language>

Target:
public List<XYSeriesConsumer> getSeries() { return fSeries; }
Source:
<code>public static AnalyzeTextOptions map(com.azure.search.documents.indexes.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeTextOptions analyzeTextOptions = null; if (obj.getTokenizer() != null) { LexicalTokenizerName tokenizer = LexicalTokenizerNameConverter.map(obj.getTokenizer()); analyzeTextOptions = new AnalyzeTextOptions(obj.getText(), tokenizer); } else { LexicalAnalyzerName analyzer = LexicalAnalyzerNameConverter.map(obj.getAnalyzer()); analyzeTextOptions = new AnalyzeTextOptions(obj.getText(), analyzer); } if (obj.getCharFilters() != null) { CharFilterName[] charFilters = obj.getCharFilters().stream() .map(CharFilterNameConverter::map) .toArray(CharFilterName[]::new); analyzeTextOptions.setCharFilters(charFilters); } if (obj.getTokenFilters() != null) { <START> TokenFilterName[] tokenFilters = obj.getTokenFilters().stream() .map(TokenFilterNameConverter::map) .toArray(TokenFilterName[]::new); <END> analyzeTextOptions.setTokenFilters(tokenFilters); } return analyzeTextOptions; }</code><technical_language>change. Input-output models setter overloads for varargs List</technical_language>

Target:
public static AnalyzeTextOptions map(com.azure.search.documents.indexes.implementation.models.AnalyzeRequest obj) { if (obj == null) { return null; } AnalyzeTextOptions analyzeTextOptions = null; if (obj.getTokenizer() != null) { LexicalTokenizerName tokenizer = LexicalTokenizerNameConverter.map(obj.getTokenizer()); analyzeTextOptions = new AnalyzeTextOptions(obj.getText(), tokenizer); } else { LexicalAnalyzerName analyzer = LexicalAnalyzerNameConverter.map(obj.getAnalyzer()); analyzeTextOptions = new AnalyzeTextOptions(obj.getText(), analyzer); } if (obj.getCharFilters() != null) { analyzeTextOptions.setCharFilters(obj.getCharFilters().stream() .map(CharFilterNameConverter::map) .toArray(CharFilterName[]::new)); } if (obj.getTokenFilters() != null) { analyzeTextOptions.setTokenFilters(obj.getTokenFilters().stream() .map(TokenFilterNameConverter::map) .toArray(TokenFilterName[]::new)); } return analyzeTextOptions; }
Source:
<code>private static AccountGroup.UUID findAdminGroup( ReviewDb db, ProjectConfig cfg) { AccountGroup.UUID adminGroup = null; List<PermissionRule> rules = cfg .getAccessSection(AccessSection.GLOBAL_CAPABILITIES) .getPermission(GlobalCapability.ADMINISTRATE_SERVER) .getRules(); for (PermissionRule rule : rules) { if (rule.getAction() == Action.ALLOW) { <START> adminGroup = rule.getGroup().getUUID(); <END> } } if (adminGroup == null) { throw new IllegalStateException("no administrator group found"); } return adminGroup; }</code><technical_language>add break group last</technical_language>

Target:
private static AccountGroup.UUID findAdminGroup( ReviewDb db, ProjectConfig cfg) { List<PermissionRule> rules = cfg .getAccessSection(AccessSection.GLOBAL_CAPABILITIES) .getPermission(GlobalCapability.ADMINISTRATE_SERVER) .getRules(); for (PermissionRule rule : rules) { if (rule.getAction() == Action.ALLOW) { return rule.getGroup().getUUID(); } } throw new IllegalStateException("no administrator group found"); }
Source:
<code><START> Scheduler getScheduler() { <END> return this.scheduler; }</code><technical_language>access modifiers</technical_language>

Target:
public Scheduler getScheduler() { return this.scheduler; }
Source:
<code>public void decompress(ByteBuffer in, int numBytes, ByteBuffer out) { final int maxCopy = Math.min(numBytes, out.remaining()); final ByteBuffer copyBuffer = in.duplicate(); copyBuffer.limit(copyBuffer.position() + maxCopy); <START> out.put(copyBuffer); <END> out.flip(); in.position(in.position() + maxCopy); }</code><technical_language>put flip chained</technical_language>

Target:
public void decompress(ByteBuffer in, int numBytes, ByteBuffer out) { final ByteBuffer copyBuffer = in.duplicate(); copyBuffer.limit(copyBuffer.position() + numBytes); out.put(copyBuffer).flip(); in.position(in.position() + numBytes); }
Source:
<code>public void testArraysOfNulls() { <START> Session session = getQueryRunner().getDefaultSession(); <END> List<String> nullArrays = ImmutableList.of("bigints", "integers", "tinyints", "smallints", "booleans", "floats"); for (String col : nullArrays) { assertQuerySucceeds(session, String.format("SELECT count(*) FROM test_arrays_of_nulls WHERE %s[1] IS NOT NULL", col)); assertQuerySucceeds(session, String.format("SELECT count(*) FROM test_arrays_of_nulls WHERE %s[1] IS NULL", col)); } }</code><technical_language>getSession() helper method</technical_language>

Target:
public void testArraysOfNulls() { getQueryRunner().execute("CREATE TABLE test_arrays_of_nulls AS " + "SELECT orderkey, linenumber, " + " CAST(ARRAY[null, null, null] AS ARRAY(BIGINT)) bigints, " + " CAST(ARRAY[null, null, null] AS ARRAY(INTEGER)) integers, " + " CAST(ARRAY[null, null, null] AS ARRAY(SMALLINT)) smallints, " + " CAST(ARRAY[null, null, null] AS ARRAY(TINYINT)) tinyints, " + " CAST(ARRAY[null, null, null] AS ARRAY(BOOLEAN)) booleans, " + " CAST(ARRAY[null, null, null] AS ARRAY(TIMESTAMP)) timestamps, " + " CAST(ARRAY[null, null, null] AS ARRAY(REAL)) floats " + "FROM lineitem"); List<String> columnNames = ImmutableList.of("bigints", "integers", "tinyints", "smallints", "booleans", "floats"); try { for (String columnName : columnNames) { assertQuerySucceeds(getSession(), format("SELECT count(*) FROM test_arrays_of_nulls WHERE %s[1] IS NOT NULL", columnName)); assertQuerySucceeds(getSession(), format("SELECT count(*) FROM test_arrays_of_nulls WHERE %s[1] IS NULL", columnName)); } } finally { getQueryRunner().execute("DROP TABLE test_arrays_of_nulls"); } }
Source:
<code>public boolean processRow(ExportRow rd) throws ExportDecoderBase.RestartBlockException { try { if (haplist.isEmpty()) { connect(); } if (haplist.isEmpty()) { m_logger.rateLimitedLog(120, Level.ERROR, null, "Failed to connect to export socket endpoint %s, some servers may be down.", host); throw new RestartBlockException(true); } if (m_logger.isDebugEnabled()) { m_logger.debug(m_source.tableName + ":P" + m_source.partitionId + " sending seqNum: " + rd.values[2]); } String decoded = m_decoder.decode(rd.generation, rd.tableName, rd.types, rd.names,null, rd.values).concat("\n"); byte b[] = decoded.getBytes(); ByteBuffer buf = ByteBuffer.allocate(b.length); buf.put(b); buf.flip(); for (Pair<OutputStream, InputStream> streams : haplist.values()) { streams.getFirst().write(buf.array()); streams.getFirst().flush(); } } catch (Exception e) { <START> m_logger.error(e.getLocalizedMessage()); <END> haplist.clear(); throw new RestartBlockException(true); } return true; }</code><technical_language>Is this error. I feel more of a warning is retried</technical_language>

Target:
public boolean processRow(ExportRow rd) throws ExportDecoderBase.RestartBlockException { try { if (haplist.isEmpty()) { connect(); } if (haplist.isEmpty()) { m_logger.rateLimitedLog(120, Level.ERROR, null, "Failed to connect to export socket endpoint %s, some servers may be down.", host); throw new RestartBlockException(true); } if (m_logger.isDebugEnabled()) { m_logger.debug(m_source.tableName + ":P" + m_source.partitionId + " sending seqNum: " + rd.values[2]); } String decoded = m_decoder.decode(rd.generation, rd.tableName, rd.types, rd.names,null, rd.values).concat("\n"); byte b[] = decoded.getBytes(); ByteBuffer buf = ByteBuffer.allocate(b.length); buf.put(b); buf.flip(); for (Pair<OutputStream, InputStream> streams : haplist.values()) { streams.getFirst().write(buf.array()); streams.getFirst().flush(); } } catch (Exception e) { m_logger.warn("Unexpected error processing row: " + e.getLocalizedMessage() + ". Row will be retried."); haplist.clear(); throw new RestartBlockException(true); } return true; }
Source:
<code>public Enumerable<Object[]> scan(DataContext root) { class TasksEnumerable extends DefaultEnumerable<Object[]> { private final JsonParserIterator<TaskStatusPlus> it; public TasksEnumerable(JsonParserIterator<TaskStatusPlus> tasks) { this.it = tasks; } @Override public Iterator<Object[]> iterator() { throw new UnsupportedOperationException("Do not use iterator(), it cannot be closed."); } @Override public Enumerator<Object[]> enumerator() { return new Enumerator<Object[]>() { @Override public Object[] current() { TaskStatusPlus task = it.next(); return new Object[]{task.getId(), task.getType(), task.getDataSource(), task.getCreatedTime(), task.getQueueInsertionTime(), task.getState(), task.getRunnerTaskState(), task.getDuration(), <START> task.getLocation() != null <END> ? task.getLocation().getHost() + ":" + (task.getLocation().getTlsPort() == -1 ? task.getLocation() .getPort() : task.getLocation().getTlsPort()) : null, task.getLocation().getHost(), task.getLocation().getPort(), task.getLocation().getTlsPort(), task.getErrorMsg()}; } @Override public boolean moveNext() { return it.hasNext(); } @Override public void reset() { } @Override public void close() { try { it.close(); } catch (IOException e) { throw new RuntimeException(e); } } }; } } return new TasksEnumerable(getTasks(druidLeaderClient, jsonMapper, responseHandler)); }</code><technical_language>location null in TaskStatusPlus</technical_language>

Target:
public Enumerable<Object[]> scan(DataContext root) { class TasksEnumerable extends DefaultEnumerable<Object[]> { private final CloseableIterator<TaskStatusPlus> it; public TasksEnumerable(JsonParserIterator<TaskStatusPlus> tasks) { this.it = getAuthorizedTasks(tasks, root); } @Override public Iterator<Object[]> iterator() { throw new UnsupportedOperationException("Do not use iterator(), it cannot be closed."); } @Override public Enumerator<Object[]> enumerator() { return new Enumerator<Object[]>() { @Override public Object[] current() { TaskStatusPlus task = it.next(); return new Object[]{task.getId(), task.getType(), task.getDataSource(), task.getCreatedTime(), task.getQueueInsertionTime(), task.getStatusCode(), task.getRunnerStatusCode(), task.getDuration(), task.getLocation().getHost() + ":" + (task.getLocation().getTlsPort() == -1 ? task.getLocation() .getPort() : task.getLocation().getTlsPort()), task.getLocation().getHost(), task.getLocation().getPort(), task.getLocation().getTlsPort(), task.getErrorMsg()}; } @Override public boolean moveNext() { return it.hasNext(); } @Override public void reset() { } @Override public void close() { try { it.close(); } catch (IOException e) { throw new RuntimeException(e); } } }; } } return new TasksEnumerable(getTasks(druidLeaderClient, jsonMapper, responseHandler)); }