auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void updateJobDeclarations(List<JobDeclaration<?, ?>> jobDeclarations, CaseDefinitionEntity definition, boolean isNewDeployment) { if(jobDeclarations == null || jobDeclarations.isEmpty()) { return; } final JobDefinitionManager jobDefinitionManager = getJobDefinitionManager(); if(isNewDeployment) { for(JobDeclaration<?,?> jobDeclaration:jobDeclarations){ <START> if(jobDeclaration instanceof TimerJobDeclaration){ <END> createJobDefinition(definition, (TimerJobDeclaration<?>) jobDeclaration); }else{ continue; } } } else { List<JobDefinitionEntity> existingDefinitions = jobDefinitionManager.findByCaseDefinitionId(definition.getId()); for (JobDeclaration<?, ?> jobDeclaration : jobDeclarations) { boolean jobDefinitionExists = false; for (JobDefinition jobDefinitionEntity : existingDefinitions) { if(jobDeclaration.getActivityId().equals(jobDefinitionEntity.getActivityId()) && jobDeclaration.getJobHandlerType().equals(jobDefinitionEntity.getJobType())) { jobDeclaration.setJobDefinitionId(jobDefinitionEntity.getId()); jobDefinitionExists = true; break; } } if(!jobDefinitionExists) { createJobDefinition(definition, (TimerJobDeclaration<?>) jobDeclaration); } } } }</code><technical_language>necessary cast it. I suggest change follows: for (JobDeclaration<?, ?> jobDeclaration : jobDeclarations) { createJobDefinition(processDefinition, jobDeclaration); }</technical_language>

Target:
protected void updateJobDeclarations(List<JobDeclaration<?, ?>> jobDeclarations, CaseDefinitionEntity definition, boolean isNewDeployment) { if(jobDeclarations == null || jobDeclarations.isEmpty()) { return; } final JobDefinitionManager jobDefinitionManager = getJobDefinitionManager(); if(isNewDeployment) { for(JobDeclaration<?,?> jobDeclaration:jobDeclarations){ createJobDefinition(definition, jobDeclaration); } } else { List<JobDefinitionEntity> existingDefinitions = jobDefinitionManager.findByCaseDefinitionId(definition.getId()); for (JobDeclaration<?, ?> jobDeclaration : jobDeclarations) { boolean jobDefinitionExists = false; for (JobDefinition jobDefinitionEntity : existingDefinitions) { if(jobDeclaration.getActivityId().equals(jobDefinitionEntity.getActivityId()) && jobDeclaration.getJobHandlerType().equals(jobDefinitionEntity.getJobType())) { jobDeclaration.setJobDefinitionId(jobDefinitionEntity.getId()); jobDefinitionExists = true; break; } } if(!jobDefinitionExists) { createJobDefinition(definition, jobDeclaration); } } } }
Source:
<code>private SurveyedLocaleResponse convertToResponse(List<SurveyedLocale> slList, Long surveyId) { SurveyedLocaleResponse resp = new SurveyedLocaleResponse(); if (slList == null) { resp.setCode(String.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); resp.setMessage("Internal Server Error"); return resp; } resp.setCode(String.valueOf(HttpServletResponse.SC_OK)); resp.setResultCount(slList.size()); <START> List<SurveyedLocaleDto> dtoList = DataPointServlet.getSurveyedLocaleDtosList(slList, surveyId); <END> resp.setSurveyedLocaleData(dtoList); return resp; }</code><technical_language>In opinion, another class/classes methods servlets. This smaller classes avoid static methods harder test</technical_language>

Target:
private SurveyedLocaleResponse convertToResponse(List<SurveyedLocale> slList, Long surveyId) { SurveyedLocaleResponse resp = new SurveyedLocaleResponse(); if (slList == null) { resp.setCode(String.valueOf(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); resp.setMessage("Internal Server Error"); return resp; } resp.setCode(String.valueOf(HttpServletResponse.SC_OK)); resp.setResultCount(slList.size()); DataPointUtil dpu = new DataPointUtil(); List<SurveyedLocaleDto> dtoList = dpu.getSurveyedLocaleDtosList(slList, surveyId); resp.setSurveyedLocaleData(dtoList); return resp; }
Source:
<code>protected TupleValueExpression visitInputRef(int tableIndex, int inputColumnIdx, RelDataType inputType, String tableName, String columnName) { <START> if (tableName == null) { <END> tableName = ""; } if (columnName == null) { columnName = String.format("%03d", inputColumnIdx); } TupleValueExpression tve = new TupleValueExpression(tableName, tableName, columnName, columnName, inputColumnIdx, inputColumnIdx); tve.setTableIndex(tableIndex); TypeConverter.setType(tve, inputType); return tve; }</code><technical_language>initial implementation more RefExpressionConvertingVisitor extends ConvertingVisitor visit / convert RexInputRef RexLocalRef Volt's AbstractExpression. visitInputRef is called of other null params TVE table, column names set for index selection purpose</technical_language>

Target:
TupleValueExpression visitInputRef(int tableIndex, int inputColumnIdx, RelDataType inputType, String tableName, String columnName) { if (tableName == null) { tableName = ""; } if (columnName == null) { columnName = String.format("%03d", inputColumnIdx); } TupleValueExpression tve = new TupleValueExpression(tableName, tableName, columnName, columnName, inputColumnIdx, inputColumnIdx); tve.setTableIndex(tableIndex); RexConverter.setType(tve, inputType); return tve; }
Source:
<code>private void process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { <START> String uri = request.getPathInfo(); <END> if (uri.startsWith("/")) { uri = uri.substring(1); } if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); } String[] uriParts = Pattern.compile("/").split(uri); if (uriParts.length == 1) { chain.doFilter(request, response); return; } String myContext = uriParts[0]; String lastPart = uriParts[uriParts.length - 1]; if (lastPart.contains(".") && !lastPart.endsWith(".profile")) { chain.doFilter(request, response); return; } String subContext = uriParts[1]; for (String knownServlet : knownServlets) { if (knownServlet.equals(subContext)) { chain.doFilter(request, response); return; } } String route = ""; for (String part : uriParts) { if (!part.equals(myContext)) { route = route + "/" + part; } } LOG.debug("Accessing {}, which isn't valid, returning index.html", request.getRequestURI()); String path = request.getRequestURI(); String context = request.getContextPath(); path = path.substring(context.length()); String qs = request.getQueryString(); response.sendRedirect(request.getContextPath() + "/#" + path + (qs != null && !"".equals(qs) ? "?" + qs : "")); }</code><technical_language>kind of bug fix? file issue explain bug submitting a pull req</technical_language>

Target:
private void process(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException { String uri = request.getRequestURI().substring(request.getContextPath().length()); if (uri.startsWith("/")) { uri = uri.substring(1); } if (uri.endsWith("/")) { uri = uri.substring(0, uri.length() - 1); } String[] uriParts = Pattern.compile("/").split(uri); if (uriParts.length == 1) { chain.doFilter(request, response); return; } String myContext = uriParts[0]; String lastPart = uriParts[uriParts.length - 1]; if (lastPart.contains(".") && !lastPart.endsWith(".profile")) { chain.doFilter(request, response); return; } String subContext = uriParts[1]; for (String knownServlet : knownServlets) { if (knownServlet.equals(subContext)) { chain.doFilter(request, response); return; } } String route = ""; for (String part : uriParts) { if (!part.equals(myContext)) { route = route + "/" + part; } } LOG.debug("Accessing {}, which isn't valid, returning index.html", request.getRequestURI()); String path = request.getRequestURI(); String context = request.getContextPath(); path = path.substring(context.length()); String qs = request.getQueryString(); response.sendRedirect(request.getContextPath() + "/#" + path + (qs != null && !"".equals(qs) ? "?" + qs : "")); }
Source:
<code>protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); SslHandler sslHandler = null; if (isClient) { sslHandler = getWaarpSslContextFactory().initInitializer(false, false); } else { sslHandler = getWaarpSslContextFactory().initInitializer(true, getWaarpSslContextFactory().needClientAuthentication()); } pipeline.addLast("ssl", sslHandler); pipeline.addLast(NetworkServerInitializer.TIMEOUT, new IdleStateHandler(0, 0, Configuration.configuration.getTIMEOUTCON(), TimeUnit.MILLISECONDS)); pipeline.addLast(NetworkServerInitializer.LIMITGLOBAL, Configuration.configuration.getGlobalTrafficShapingHandler()); pipeline.addLast(NetworkServerInitializer.LIMITCHANNEL, new ChannelTrafficShapingHandler( Configuration.configuration.getServerChannelWriteLimit(), Configuration.configuration.getServerChannelReadLimit(), Configuration.configuration.getDelayLimit())); <START> pipeline.addLast("codec", new NetworkPacketCodec()); <END> pipeline.addLast(Configuration.configuration.getHandlerGroup(), "handler", new NetworkSslServerHandler(!this.isClient)); }</code><technical_language>this TrafficShaping ? side... is right position there..</technical_language>

Target:
protected void initChannel(SocketChannel ch) throws Exception { final ChannelPipeline pipeline = ch.pipeline(); SslHandler sslHandler = null; if (isClient) { sslHandler = getWaarpSslContextFactory().initInitializer(false, false); } else { sslHandler = getWaarpSslContextFactory().initInitializer(true, getWaarpSslContextFactory().needClientAuthentication()); } pipeline.addLast("ssl", sslHandler); pipeline.addLast(NetworkServerInitializer.TIMEOUT, new IdleStateHandler(0, 0, Configuration.configuration.getTIMEOUTCON(), TimeUnit.MILLISECONDS)); GlobalTrafficShapingHandler handler = Configuration.configuration.getGlobalTrafficShapingHandler(); if (handler == null) { throw new OpenR66ProtocolNetworkException( "Error at pipeline initialization," + " GlobalTrafficShapingHandler configured."); } pipeline.addLast(NetworkServerInitializer.LIMITGLOBAL, handler); pipeline.addLast(NetworkServerInitializer.LIMITCHANNEL, new ChannelTrafficShapingHandler( Configuration.configuration.getServerChannelWriteLimit(), Configuration.configuration.getServerChannelReadLimit(), Configuration.configuration.getDelayLimit())); pipeline.addLast("codec", new NetworkPacketCodec()); pipeline.addLast(Configuration.configuration.getHandlerGroup(), "handler", new NetworkSslServerHandler(!this.isClient)); }
Source:
<code>protected void executeCommand() { if (getDisk().getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = getDiskImage(); RemoveImageParameters p = new RemoveImageParameters(diskImage.getImageId()); p.setTransactionScopeOption(TransactionScopeOption.Suppress); p.setDiskImage(diskImage); p.setParentCommand(VdcActionType.RemoveDisk); p.setRemoveDuringExecution(false); p.setEntityId(getParameters().getEntityId()); p.setParentParameters(getParameters()); p.setStorageDomainId(getParameters().getStorageDomainId()); p.setForceDelete(getParameters().getForceDelete()); if (diskImage.getstorage_ids().size() == 1) { p.setRemoveFromDB(true); } VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveImage, p, ExecutionHandler.createDefaultContexForTasks(getExecutionContext(), getLock())); setLock(null); if (vdcReturnValue.getSucceeded()) { getParameters().getImagesParameters().add(p); setSucceeded(vdcReturnValue.getSucceeded()); <START> if (vdcReturnValue.getInternalTaskIdList().isEmpty()) { <END> endCommand(); } else { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); } } } else { removeLunDisk(); } }</code><technical_language>In this point, I understand a list is empty task created of ImageDoesnptExist error Network Error (call vdsm fail) failed create a task other error (For example CanNotAcquireSanLock)</technical_language>

Target:
protected void executeCommand() { if (getDisk().getDiskStorageType() == DiskStorageType.IMAGE) { DiskImage diskImage = getDiskImage(); RemoveImageParameters p = new RemoveImageParameters(diskImage.getImageId()); p.setTransactionScopeOption(TransactionScopeOption.Suppress); p.setDiskImage(diskImage); p.setParentCommand(VdcActionType.RemoveDisk); p.setRemoveDuringExecution(false); p.setEntityId(getParameters().getEntityId()); p.setParentParameters(getParameters()); p.setStorageDomainId(getParameters().getStorageDomainId()); p.setForceDelete(getParameters().getForceDelete()); if (diskImage.getStorageIds().size() == 1) { p.setRemoveFromDB(true); } VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveImage, p, ExecutionHandler.createDefaultContexForTasks(getExecutionContext(), getLock())); setLock(null); if (vdcReturnValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); setSucceeded(vdcReturnValue.getSucceeded()); if (getReturnValue().getFault().getError() == VdcBllErrors.ImageDoesNotExistInDomainError) { TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { endCommand(); return null; } }); } else { getReturnValue().getTaskIdList().addAll(vdcReturnValue.getInternalTaskIdList()); } } } else { removeLunDisk(); } }
Source:
<code>private void updateMenuItem() { if (menuItem != null && !menuItem.isDisposed() && menuExist()) { <START> boolean enabled = removeAllWhenShown || menu.getItemCount() > 0 || getItems().length > 0; <END> if (menuItem.getEnabled() != enabled) { Menu topMenu = menu; while (topMenu.getParentMenu() != null) { topMenu = topMenu.getParentMenu(); } if ((topMenu.getStyle() & SWT.BAR) == 0) { menuItem.setEnabled(enabled); } } } }</code><technical_language>getItems().length > 0 implies menu.getItemCount() > 0, menu.getItemCount check removed. getItems().length is sufficent, checked of items is visible, e.g. Stream.of(getItems()).anyMatch(IContributionItem::isVisible)</technical_language>

Target:
private void updateMenuItem() { }
Source:
<code>public void clearPositionsHistory() throws SQLException { <START> String histDays = config.getString("database.positionsHistoryDays"); <END> if (histDays == null) { histDays = "7"; } int n = Integer.parseInt(histDays); for (Device device : getAllDevices()) { Date lastUpdate = device.getLastUpdate(); if(lastUpdate != null){ Date dateBefore = new Date(lastUpdate.getTime() - n * 24 * 3600 * 1000 ); String sql = "DELETE FROM positions WHERE deviceid=:deviceId and servertime<:serverTime"; QueryBuilder.create(dataSource, sql) .setLong("deviceId", device.getId()) .setDate("serverTime", dateBefore) .executeUpdate(); } } }</code><technical_language>getInteger instead</technical_language>

Target:
public void clearPositionsHistory() throws SQLException { int histDays = config.getInteger("database.positionsHistoryDays"); if (histDays == 0) { return; } String sql = getQuery("database.clearPositionsHistory"); if (sql == null) { return; } for (Device device : getAllDevices()) { Date lastUpdate = device.getLastUpdate(); if (lastUpdate != null) { Date dateBefore = new Date(lastUpdate.getTime() - histDays * 24 * 3600 * 1000); QueryBuilder.create(dataSource, sql) .setLong("positionId", device.getPositionId()) .setLong("deviceId", device.getId()) .setDate("serverTime", dateBefore) .executeUpdate(); } } }
Source:
<code>private boolean isDateSelectable(Date date) { <START> if (isCheckDayInSelectableCals && !containsDate(selectableCals, date)) return false; <END> return dateConfiguredListener == null || dateConfiguredListener.isDateSelectable(date); }</code><technical_language>{ } fold conditional a single return statement</technical_language>

Target:
private boolean isDateSelectable(Date date) { if (isCheckDayInSelectableCals && !containsDate(selectableCals, date)) { return false; } return dateConfiguredListener == null || dateConfiguredListener.isDateSelectable(date); }
Source:
<code>public static void main(String[] args) throws Exception { List<String> tmpArgs = new ArrayList<String>(Arrays.asList(args)); args = tmpArgs.toArray(new String[0]); StringBuilder cliString = new StringBuilder(); for (int i = 0; i < args.length; i++) { cliString.append(" ").append(args[i]); } logger.debug("Command line string = {}", cliString.toString()); System.out.println("Command line string = " + cliString.toString()); Task task; try { task = ClassOption.cliStringToObject(cliString.toString(), Task.class, null); logger.debug("Successfully instantiating {}", task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Failed to initialize the task: ", e); System.out.println("Failed to initialize the task: " + e); return; } StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); <START> logger.debug("Creating the factory\n"); <END> task.setFactory(new FlinkComponentFactory(env)); logger.debug("Going to initialize the task\n"); task.init(); circles = extractTopologyGraph((FlinkTopology) task.getTopology()); logger.debug("Going to build the topology\n"); ((FlinkTopology) task.getTopology()).build(); logger.debug("Execute environment\n"); env.execute(); }</code><technical_language>Do need final '\n'</technical_language>

Target:
public static void main(String[] args) throws Exception { List<String> tmpArgs = new ArrayList<String>(Arrays.asList(args)); args = tmpArgs.toArray(new String[0]); StringBuilder cliString = new StringBuilder(); for (int i = 0; i < args.length; i++) { cliString.append(" ").append(args[i]); } logger.debug("Command line string = {}", cliString.toString()); System.out.println("Command line string = " + cliString.toString()); Task task; try { task = ClassOption.cliStringToObject(cliString.toString(), Task.class, null); logger.debug("Successfully instantiating {}", task.getClass().getCanonicalName()); } catch (Exception e) { logger.error("Failed to initialize the task: ", e); System.out.println("Failed to initialize the task: " + e); return; } StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); task.setFactory(new FlinkComponentFactory(env)); task.init(); logger.debug("Building Flink topology..."); ((FlinkTopology) task.getTopology()).build(); logger.debug("Submitting the job..."); env.execute(); }
Source:
<code>public VolumeImpl(Volume value) { <START> if (value != null) { <END> path = value.getPath(); } else { path = null; } }</code><technical_language>check null here</technical_language>

Target:
public VolumeImpl(Volume value) { path = value.getPath(); }
Source:
<code>public String getRemoteAddr() { <START> return HostUtils.getIpAddress(); <END> }</code><technical_language>@kahowell This is fetching local address, remote address</technical_language>

Target:
public String getRemoteAddr() { return ResteasyProviderFactory.getContextData(HttpServletRequest.class).getRemoteAddr(); }
Source:
<code>public long getCurrentStartTime() { long currentStart = Long.MAX_VALUE; <START> for (Stream stream : fStreams.values()) { <END> for (StreamInput si : stream.getStreamInputs()) { currentStart = Math.min(currentStart, si.getIndex().getEntries().get(0).getTimestampBegin()); } } return timestampCyclesToNanos(currentStart); }</code><technical_language>Compilation error Stream renamed CTFStream</technical_language>

Target:
public long getCurrentStartTime() { long currentStart = Long.MAX_VALUE; for (CTFStream stream : fStreams.values()) { for (CTFStreamInput si : stream.getStreamInputs()) { currentStart = Math.min(currentStart, si.getIndex().getEntries().get(0).getTimestampBegin()); } } return timestampCyclesToNanos(currentStart); }
Source:
<code><START> private ImmutableList<JavaFileScannerContext.Location> methodInvocationFlow(Constraint learnedConstraint, ExplodedGraph.Edge edge) { <END> ExplodedGraph.Node parent = edge.parent; MethodInvocationTree mit = (MethodInvocationTree) parent.programPoint.syntaxTree(); ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); SymbolicValue returnSV = edge.child.programState.peekValue(); if (symbolicValues.contains(returnSV)) { flowBuilder.add(location(parent, String.format("'%s()' returns %s.", mit.symbol().name(), learnedConstraint.valueAsString()))); } SymbolicValue invocationTarget = parent.programState.peekValue(mit.arguments().size()); if (symbolicValues.contains(invocationTarget)) { flowBuilder.add(location(parent, "...")); } List<Integer> argumentIndices = correspondingArgumentIndices(symbolicValues, parent); argumentIndices.stream() .map(mit.arguments()::get) .map(argTree -> { String message = String.format("Implies '%s' is %s.", SyntaxTreeNameFinder.getName(argTree), learnedConstraint.valueAsString()); return new JavaFileScannerContext.Location(message, argTree); }) .forEach(flowBuilder::add); MethodYield selectedMethodYield = edge.child.selectedMethodYield(parent); if (selectedMethodYield != null) { if (symbolicValues.contains(returnSV)) { argumentIndices.add(-1); } selectedMethodYield.flow(argumentIndices, domains).stream() .limit(1) .flatMap(List::stream) .forEach(flowBuilder::add); } return flowBuilder.build(); }</code><technical_language>I rely interface, for a private method</technical_language>

Target:
private List<JavaFileScannerContext.Location> methodInvocationFlow(Constraint learnedConstraint, ExplodedGraph.Edge edge) { ExplodedGraph.Node parent = edge.parent; MethodInvocationTree mit = (MethodInvocationTree) parent.programPoint.syntaxTree(); ImmutableList.Builder<JavaFileScannerContext.Location> flowBuilder = ImmutableList.builder(); SymbolicValue returnSV = edge.child.programState.peekValue(); if (symbolicValues.contains(returnSV)) { flowBuilder.add(location(parent, String.format("'%s()' returns %s.", mit.symbol().name(), learnedConstraint.valueAsString()))); } SymbolicValue invocationTarget = parent.programState.peekValue(mit.arguments().size()); if (symbolicValues.contains(invocationTarget)) { flowBuilder.add(location(parent, "...")); } List<Integer> argumentIndices = correspondingArgumentIndices(symbolicValues, parent); argumentIndices.stream() .map(mit.arguments()::get) .map(argTree -> { String message = String.format("Implies '%s' is %s.", SyntaxTreeNameFinder.getName(argTree), learnedConstraint.valueAsString()); return new JavaFileScannerContext.Location(message, argTree); }) .forEach(flowBuilder::add); return flowBuilder.build(); }
Source:
<code>public Set<Item> getAllMembers() { Set<Item> allMembers = new HashSet<Item>(); <START> collectMembers(allMembers, members, false); <END> return ImmutableSet.copyOf(allMembers); }</code><technical_language>cool if getMembers(Predicate) here</technical_language>

Target:
public Set<Item> getAllMembers() { return ImmutableSet.copyOf(getMembers((Item i) -> !(i instanceof GroupItem))); }
Source:
<code>private String getRawString(final String section, final String subsection, final String name) { String[] lst = getRawStringList(section, subsection, name); if (lst != null) <START> return lst[lst.length - 1]; <END> else if (baseConfig != null) return baseConfig.getRawString(section, subsection, name); else return null; }</code><technical_language>style nit: a while curly braces single line blocks missing braces added touching code this rule</technical_language>

Target:
private String getRawString(final String section, final String subsection, final String name) { String[] lst = getRawStringList(section, subsection, name); if (lst != null) { return lst[lst.length - 1]; } else if (baseConfig != null) { return baseConfig.getRawString(section, subsection, name); } else { return null; } }
Source:
<code>public static NIC map(VmNetworkInterface entity, NIC template) { NIC model = template != null ? template : new NIC(); if (entity.getVmId() != null) { model.setVm(new VM()); model.getVm().setId(entity.getVmId().toString()); } if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getName() != null) { model.setName(entity.getName()); } if (entity.getMacAddress() != null) { model.setMac(new MAC()); model.getMac().setAddress(entity.getMacAddress()); } if (entity.getNetworkName() != null) { model.setNetwork(new Network()); model.getNetwork().setName(entity.getNetworkName()); } <START> if (entity.isPortMirroring()) { <END> PortMirroring portMirroring = new PortMirroring(); Networks networks = new Networks(); Network net = new Network(); portMirroring.setNetworks(networks); portMirroring.getNetworks().getNetworks().add(net); model.setPortMirroring(portMirroring); } model.setInterface(map(entity.getType())); model.setActive(entity.isActive()); return model; }</code><technical_language>need this mapping P.M set in populate() of resource collection (at in this version)</technical_language>

Target:
public static NIC map(VmNetworkInterface entity, NIC template) { NIC model = template != null ? template : new NIC(); if (entity.getVmId() != null) { model.setVm(new VM()); model.getVm().setId(entity.getVmId().toString()); } if (entity.getId() != null) { model.setId(entity.getId().toString()); } if (entity.getName() != null) { model.setName(entity.getName()); } if (entity.getMacAddress() != null) { model.setMac(new MAC()); model.getMac().setAddress(entity.getMacAddress()); } if (entity.getNetworkName() != null) { model.setNetwork(new Network()); model.getNetwork().setName(entity.getNetworkName()); } model.setInterface(map(entity.getType())); model.setActive(entity.isActive()); return model; }
Source:
<code>public void onTraversalStart() { Utils.regularReadableUserFile(truth); variantStatusWriter = VariantStatusRecord.getWriter(table); SAMSequenceDictionary dictionary = getSequenceDictionaryForDrivingVariants(); variantContextComparator = new VariantContextComparator(dictionary); <START> if (! getHeaderForVariants().getSampleNamesInOrder().contains(evalSampleName)){ <END> throw new IllegalArgumentException(String.format("the eval sample %s does not exist in vcf", evalSampleName)); } final FeatureDataSource<VariantContext> truthSource = new FeatureDataSource<>(truth); truthIterator = truthSource.iterator(); currentTruthVariant = getNextNonSVTruthVariant(); }</code><technical_language>Utils.validateArg</technical_language>

Target:
public void onTraversalStart() { Utils.regularReadableUserFile(truth); Utils.validateArg(getHeaderForVariants().getSampleNamesInOrder().contains(evalSampleName), String.format("the eval sample %s does not exist in vcf", evalSampleName)); variantStatusWriter = VariantStatusRecord.getWriter(table); SAMSequenceDictionary dictionary = getSequenceDictionaryForDrivingVariants(); variantContextComparator = new VariantContextComparator(dictionary); final FeatureDataSource<VariantContext> truthSource = new FeatureDataSource<>(truth); numVariantsInTruth = truthSource.spliterator().getExactSizeIfKnown(); truthIterator = new FilterIterator<>(truthSource.iterator(), vc -> ! vc.isSymbolicOrSV()); if (truthIterator.hasNext()){ currentTruthVariant = truthIterator.next(); } else { throw new UserException(String.format("truth file %s does not have any variants", truth.toString())); } }
Source:
<code>public synchronized void execDistributedImmediately(@NonNull TrainingMessage message) { <START> transport.sendMessageToAllShards(message); <END> }</code><technical_language>a future synchronized here</technical_language>

Target:
public void execDistributedImmediately(@NonNull TrainingMessage message) { transport.sendMessageToAllShards(message); }
Source:
<code>public Class[] getAdapterList() { <START> return new Class[] { CMLMolecule.class }; <END> }</code><technical_language>ICDKMolecule is type is asked for</technical_language>

Target:
public Class[] getAdapterList() { return new Class[] { ICDKMolecule.class }; }
Source:
<code>public void testDescriptiveInXemblyLog() throws Exception { final Time scheduled = new Time(); final Instance origin = Mockito.mock(Instance.class); <START> Mockito.doAnswer( <END> new Answer<Void>() { @Override public Void answer(final InvocationOnMock inv) throws Exception { return null; } } ).when(origin).pulse(); final Work work = Mockito.mock(Work.class); Mockito.doAnswer( new Answer<URI>() { @Override public URI answer(final InvocationOnMock inv) throws Exception { return URI.create("urn:facebook:1"); } } ).when(work).stdout(); Mockito.doAnswer( new Answer<Time>() { @Override public Time answer(final InvocationOnMock inv) throws Exception { return scheduled; } } ).when(work).scheduled(); Mockito.doAnswer( new Answer<URN>() { @Override public URN answer(final InvocationOnMock inv) throws Exception { return URN.create("urn:facebook:2"); } } ).when(work).owner(); Mockito.doAnswer( new Answer<String>() { @Override public String answer(final InvocationOnMock inv) throws Exception { return "test-rule"; } } ).when(work).rule(); final Descriptive descriptive = new Descriptive( work, origin ); descriptive.pulse(); Mockito.verify(origin, Mockito.times(1)).pulse(); Mockito.verify(work, Mockito.times(1)).rule(); Mockito.verify(work, Mockito.times(1)).scheduled(); Mockito.verify(work, Mockito.times(1)).stdout(); Mockito.verify(work, Mockito.times(1)).owner(); }</code><technical_language>doAnswer() a simple doReturn() do same? problem for other cases</technical_language>

Target:
public void testDescriptiveInXemblyLog() throws Exception { final Time scheduled = new Time(); final Instance origin = Mockito.mock(Instance.class); final Work work = Mockito.mock(Work.class); Mockito.doReturn(URI.create("urn:facebook:1")).when(work).stdout(); Mockito.doReturn(scheduled).when(work).scheduled(); Mockito.doReturn(URN.create("urn:facebook:2")).when(work).owner(); Mockito.doReturn("test-rule").when(work).rule(); final Descriptive descriptive = new Descriptive( work, origin ); descriptive.pulse(); Mockito.verify(origin).pulse(); Mockito.verify(work).rule(); Mockito.verify(work).scheduled(); Mockito.verify(work).stdout(); Mockito.verify(work).owner(); }
Source:
<code>static public MatrixLib createRowVector(double... args) { double[][] ary = new double[1][args.length]; for (int i = 0; i < args.length; i++) { <START> ary[0][i] = args[i]; <END> } return MatrixFactory.fromArray(ary); }</code><technical_language>arrays.copy? system.copy</technical_language>

Target:
static public MatrixLib createRowVector(double... args) { double[][] ary = new double[1][args.length]; System.arraycopy(args, 0, ary[0], 0, args.length); return MatrixFactory.fromArray(ary); }
Source:
<code>private void testSearch() { ______TS("search for nothing"); String searchContent = ""; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isPageTitleCorrect()); assertTrue(isSearchPanelPresent()); assertTrue(isEmptyKeyErrorMessageShown()); ______TS("search for student1"); searchPage.clearSearchBox(); searchContent = "student1"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); <START> ______TS("search for studentNameWithSpecialCharacters"); <END> searchPage.clearSearchBox(); searchContent = "student(1)"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); }</code><technical_language>studentNameWithSpecialCharacters need camelCase</technical_language>

Target:
private void testSearch() { ______TS("search for nothing"); String searchContent = ""; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isPageTitleCorrect()); assertTrue(isSearchPanelPresent()); assertTrue(isEmptyKeyErrorMessageShown()); ______TS("search for student1"); searchPage.clearSearchBox(); searchContent = "student1"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); ______TS("search for student name with special characters"); searchPage.clearSearchBox(); searchContent = "student(1)"; searchPage.inputSearchContent(searchContent); searchPage.clickSearchButton(); assertTrue(isSearchPanelPresent()); assertTrue(isSearchDataDisplayCorrect()); }
Source:
<code>public static Mode getMode(Run run) { return Optional.ofNullable(run.get(LaunchUtils.Mode.class.getName())) <START> .map(s -> valueOf(s)) <END> .orElse(UNSET); }</code><technical_language>this more simply: java .map(Mode::valueOf)</technical_language>

Target:
public static Mode getMode(Run run) { return Optional.ofNullable(run.get(LaunchUtils.Mode.class.getName())) .map(Mode::valueOf) .orElse(UNSET); }
Source:
<code>public void copyInitialState(Path origAppDir) throws IOException { String newAppDir = this.dag.assertAppPath(); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(origAppDir.toString(), conf); Object snapshot = recoveryHandler.restore(); if (snapshot == null) { throw new IllegalArgumentException("No previous application state found in " + origAppDir); } InputStream logIs = recoveryHandler.getLog(); ((StreamingContainerManager.CheckpointState)snapshot).setApplicationId(this.dag, conf); Path checkpointPath = new Path(newAppDir, LogicalPlan.SUBDIR_CHECKPOINTS); FileSystem fs = FileSystem.newInstance(origAppDir.toUri(), conf); fs.delete(checkpointPath, true); recoveryHandler = new FSRecoveryHandler(newAppDir, conf); recoveryHandler.save(snapshot); OutputStream logOs = recoveryHandler.rotateLog(); IOUtils.copy(logIs, logOs); logOs.flush(); logOs.close(); logIs.close(); FileStatus[] lFiles = fs.listStatus(origAppDir); for (FileStatus f : lFiles) { if (f.isDirectory()) { <START> String targetPath = f.getPath().toString().replace(" END> if (!fs.exists(new Path(targetPath))) { LOG.debug("Copying to {}", f.getPath(), targetPath); FileUtil.copy(fs, f.getPath(), fs, new Path(targetPath), false, conf); } else { LOG.debug("Ignoring as it already exists under {}", f.getPath(), targetPath); } } } }</code><technical_language>squash commits</technical_language>

Target:
public void copyInitialState(Path origAppDir) throws IOException { String newAppDir = this.dag.assertAppPath(); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(origAppDir.toString(), conf); Object snapshot = recoveryHandler.restore(); if (snapshot == null) { throw new IllegalArgumentException("No previous application state found in " + origAppDir); } InputStream logIs = recoveryHandler.getLog(); ((StreamingContainerManager.CheckpointState)snapshot).setApplicationId(this.dag, conf); Path checkpointPath = new Path(newAppDir, LogicalPlan.SUBDIR_CHECKPOINTS); FileSystem fs = FileSystem.newInstance(origAppDir.toUri(), conf); fs.delete(checkpointPath, true); recoveryHandler = new FSRecoveryHandler(newAppDir, conf); recoveryHandler.save(snapshot); OutputStream logOs = recoveryHandler.rotateLog(); IOUtils.copy(logIs, logOs); logOs.flush(); logOs.close(); logIs.close(); FileStatus[] lFiles = fs.listStatus(origAppDir); String origAppDirPath = Path.getPathWithoutSchemeAndAuthority(origAppDir).toString(); String newAppDirPath = Path.getPathWithoutSchemeAndAuthority(new Path(newAppDir)).toString(); for (FileStatus f : lFiles) { if (f.isDirectory()) { String targetPath = f.getPath().toString().replace(origAppDirPath, newAppDirPath); if (!fs.exists(new Path(targetPath))) { LOG.debug("Copying to {}", f.getPath(), targetPath); FileUtil.copy(fs, f.getPath(), fs, new Path(targetPath), false, conf); } else { LOG.debug("Ignoring as it already exists under {}", f.getPath(), targetPath); } } } }
Source:
<code>public void testRandomSublist() { final Random random = new Random(); <START> final List<Integer> list = new ArrayList<>(); <END> list.add(1); list.add(2); list.add(3); Assert.assertEquals(list, MathUtil.randomSublist(list, 3, random)); Assert.assertEquals(list, MathUtil.randomSublist(list, 4, random)); Assert.assertEquals(MathUtil.randomSublist(list, 2, random).size(), 2); }</code><technical_language>write this final List<Integer> list = Arrays.asList(1, 2, 3);</technical_language>

Target:
public void testRandomSublist() { final Random random = new Random(); final List<Integer> list = Arrays.asList(1,2,3); Assert.assertEquals(list, MathUtil.randomSublist(list, 3, random)); Assert.assertEquals(list, MathUtil.randomSublist(list, 4, random)); Assert.assertEquals(MathUtil.randomSublist(list, 2, random).size(), 2); }
Source:
<code>private String readInteractively(String prompt, boolean isPassword) { String value = null; <START> while (StringUtils.isBlank(value)) { <END> System.out.print(prompt); if (isPassword) { value = new String(System.console().readPassword()); } else { value = System.console().readLine(); } } return value; }</code><technical_language>This call "isBlank" is checking null</technical_language>

Target:
private String readInteractively(String prompt, boolean isPassword) { String value = null; while (StringUtils.isBlank(value)) { if (isPassword) { value = new String(System.console().readPassword(prompt)); } else { value = System.console().readLine(prompt); } } return value; }
Source:
<code>public void testSerialization() { <START> assertThat(storage.getKeys().size(), is(0)); <END> storage.put("Key1", new PersistedItem("String", Arrays.asList("LIGHT", "GROUND_FLOOR"))); storage.put("Key2", new PersistedItem("Number", Arrays.asList("TEMPERATURE", "OUTSIDE"))); assertThat(storage.getKeys().size(), is(2)); storage.get("Key1"); storage.remove("Key1"); storage.remove("Key2"); assertThat(storage.getKeys().size(), is(0)); }</code><technical_language>IsCollectionOfSize.hasSize() here. this require java test dependencies required bundles Require-Bundle: org.junit,org.mockito,org.hamcrest for full hamcrest library. choice. results in assertThat(storage.getKeys(), hasSize(0));</technical_language>

Target:
public void testSerialization() { assertThat(storage.getKeys().size(), is(0)); storage.put("Key1", new PersistedItem("String", Arrays.asList("LIGHT", "GROUND_FLOOR"))); storage.put("Key2", new PersistedItem("Number", Arrays.asList("TEMPERATURE", "OUTSIDE"))); assertThat(storage.getKeys().size(), is(2)); storage.remove("Key1"); storage.remove("Key2"); assertThat(storage.getKeys().size(), is(0)); }
Source:
<code>protected void addVmGraphicsOptions(Map<GraphicsType, GraphicsInfo> infos, Map<String, Object> params, boolean legacyNames) { if (infos != null && infos.containsKey(GraphicsType.SPICE)) { params.put(VdsProperties.spiceFileTransferEnable, Boolean.toString(vm.isSpiceFileTransferEnabled())); params.put(VdsProperties.spiceCopyPasteEnable, Boolean.toString(vm.isSpiceCopyPasteEnabled())); if (Config.<Boolean>getValue(ConfigValues.SSLEnabled)) { params.put(VdsProperties.spiceSslCipherSuite, Config.<String>getValue(ConfigValues.CipherSuite)); params.put(VdsProperties.SpiceSecureChannels, Config.<String>getValue( ConfigValues.SpiceSecureChannels, vm.getCompatibilityVersion().toString())); } } if (infos != null && infos.containsKey(GraphicsType.VNC)) { String keyboardLayout = vm.getDynamicData().getVncKeyboardLayout(); if (keyboardLayout == null) { keyboardLayout = vm.getDefaultVncKeyboardLayout(); if (keyboardLayout == null) { keyboardLayout = Config.<String> getValue(ConfigValues.VncKeyboardLayout); } } <START> if (legacyNames) { <END> params.put(VdsProperties.KeyboardLayout, keyboardLayout); } else { params.put(VdsProperties.KeyboardMap, keyboardLayout); } params.put(VdsProperties.TabletEnable, "true"); } }</code><technical_language>a note drop this ugliness in 4.1 great</technical_language>

Target:
protected void addVmGraphicsOptions(Map<GraphicsType, GraphicsInfo> infos, Map<String, Object> params, boolean legacyNames) { if (infos != null && infos.containsKey(GraphicsType.SPICE)) { params.put(VdsProperties.spiceFileTransferEnable, Boolean.toString(vm.isSpiceFileTransferEnabled())); params.put(VdsProperties.spiceCopyPasteEnable, Boolean.toString(vm.isSpiceCopyPasteEnabled())); if (Config.<Boolean>getValue(ConfigValues.SSLEnabled)) { params.put(VdsProperties.spiceSslCipherSuite, Config.<String>getValue(ConfigValues.CipherSuite)); params.put(VdsProperties.SpiceSecureChannels, Config.<String>getValue( ConfigValues.SpiceSecureChannels, vm.getCompatibilityVersion().toString())); } } if (infos != null && infos.containsKey(GraphicsType.VNC)) { String keyboardLayout = vm.getDynamicData().getVncKeyboardLayout(); if (keyboardLayout == null) { keyboardLayout = vm.getDefaultVncKeyboardLayout(); if (keyboardLayout == null) { keyboardLayout = Config.<String> getValue(ConfigValues.VncKeyboardLayout); } } if (legacyNames) { params.put(VdsProperties.KeyboardLayout, keyboardLayout); } else { params.put(VdsProperties.KeyboardMap, keyboardLayout); } } }
Source:
<code>public String errString() { <START> return RawParseUtils.decode(err.toByteArray()); <END> }</code><technical_language>Likewise</technical_language>

Target:
public String errString() { return new String(err.toByteArray(), UTF_8); }
Source:
<code>public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ChromeScreenshotReportSource that = (ChromeScreenshotReportSource) o; return _ignoreCertificateErrors == that._ignoreCertificateErrors && Objects.equals(getId(), that.getId()) && Objects.equals(getUrl(), that.getUrl()) && Objects.equals(getTitle(), that.getTitle()) <START> && Objects.equals(getTriggeringEventName(), that.getTriggeringEventName()); <END> }</code><technical_language>accessors members; preference is members</technical_language>

Target:
public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ChromeScreenshotReportSource that = (ChromeScreenshotReportSource) o; return _ignoreCertificateErrors == that._ignoreCertificateErrors && Objects.equals(_id, that._id) && Objects.equals(_uri, that._uri) && Objects.equals(_title, that._title) && Objects.equals(_triggeringEventName, that._triggeringEventName); }
Source:
<code>public final void testStorePlanWithRCFile() throws IOException, PlanningException { FileFragment[] frags = FileStorageManager.splitNG(conf, "default.score", score.getMeta(), score.getPath(), Integer.MAX_VALUE); Path workDir = CommonTestingUtil.getTestDir("target/test-data/testStorePlanWithRCFile"); TaskAttemptContext ctx = new TaskAttemptContext(new QueryContext(conf), LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan), new FileFragment[] { frags[0] }, workDir); ctx.setEnforcer(new Enforcer()); ctx.setOutputPath(new Path(workDir, "grouped2")); Expr context = analyzer.parse(CreateTableAsStmts[1]); LogicalPlan plan = planner.createPlan(defaultContext, context); LogicalNode rootNode = optimizer.optimize(plan); TableMeta outputMeta = CatalogUtil.newTableMeta(StoreType.RCFILE); PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf); PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode); exec.init(); exec.next(); exec.close(); <START> Scanner scanner = ((FileStorageManager)StorageManager.getFileStorageManager(conf)).getFileScanner(outputMeta, rootNode.getOutSchema(), <END> ctx.getOutputPath()); scanner.init(); Tuple tuple; int i = 0; while ((tuple = scanner.next()) != null) { assertEquals(6, tuple.get(2).asInt4()); assertEquals(3, tuple.get(3).asInt4()); assertEquals(1, tuple.get(4).asInt4()); i++; } assertEquals(10, i); scanner.close(); assertEquals(10, ctx.getResultStats().getNumRows().longValue()); }</code><technical_language>line exceeds 120 column width</technical_language>

Target:
public final void testStorePlanWithRCFile() throws IOException, PlanningException { FileFragment[] frags = FileStorageManager.splitNG(conf, "default.score", score.getMeta(), new Path(score.getPath()), Integer.MAX_VALUE); Path workDir = CommonTestingUtil.getTestDir("target/test-data/testStorePlanWithRCFile"); TaskAttemptContext ctx = new TaskAttemptContext(new QueryContext(conf), LocalTajoTestingUtility.newQueryUnitAttemptId(masterPlan), new FileFragment[] { frags[0] }, workDir); ctx.setEnforcer(new Enforcer()); ctx.setOutputPath(new Path(workDir, "grouped2")); Expr context = analyzer.parse(CreateTableAsStmts[1]); LogicalPlan plan = planner.createPlan(defaultContext, context); LogicalNode rootNode = optimizer.optimize(plan); TableMeta outputMeta = CatalogUtil.newTableMeta(StoreType.RCFILE); PhysicalPlanner phyPlanner = new PhysicalPlannerImpl(conf); PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode); exec.init(); exec.next(); exec.close(); Scanner scanner = ((FileStorageManager)StorageManager.getFileStorageManager(conf)).getFileScanner( outputMeta, rootNode.getOutSchema(), ctx.getOutputPath()); scanner.init(); Tuple tuple; int i = 0; while ((tuple = scanner.next()) != null) { assertEquals(6, tuple.get(2).asInt4()); assertEquals(3, tuple.get(3).asInt4()); assertEquals(1, tuple.get(4).asInt4()); i++; } assertEquals(10, i); scanner.close(); assertEquals(10, ctx.getResultStats().getNumRows().longValue()); }
Source:
<code><START> public static <T> void assertFieldValues(String hintMessage, Map<T, String> fields, FormPage<T> page) { <END> String formatString = hintMessage + " field '%s' value"; fields.forEach((key, val) -> { String fieldValue = page.getField(key); if (val == null) { assertTrue(String.format(formatString, key.toString()) + " expected null", isStringEmptyOrNull(fieldValue)); } else { assertEquals(String.format(formatString, key.toString()), val, page.getField(key)); } }); }</code><technical_language>here. If changes, erase generic argument</technical_language>

Target:
public static <T extends FieldElement> void assertFieldValues(String hintMessage, Map<T, String> fields, FormPage<T> page) { String formatString = hintMessage + " field '%s' value"; fields.forEach((key, val) -> { String fieldValue = page.getField(key); if (val == null) { assertTrue(String.format(formatString, key.toString()) + " expected null", isStringEmptyOrNull(fieldValue)); } else { assertEquals(String.format(formatString, key.toString()), val, page.getField(key)); } }); }
Source:
<code>public BaseOrionExpectTest() { <START> provider = "orion"; <END> }</code><technical_language>In other places "orionblob" provider (e.g. OrionBlobContainerLiveTest). good consistent</technical_language>

Target:
public BaseOrionExpectTest() { this.provider = "orionblob"; }
Source:
<code>public void initGui() { super.initGui(); <START> <END> myScrollBar.setLeft( 175 ); myScrollBar.setHeight( 106 ); myScrollBar.setTop( 18 ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 107, offsetX ), this.guiTop + 6, 64, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); searchField.setMaxStringLength( 25 ); searchField.setTextColor( 0xFFFFFF ); searchField.setVisible( true ); }</code><technical_language>Whitespace change, especially this is in commit it</technical_language>

Target:
public void initGui() { super.initGui(); myScrollBar.setLeft( 175 ); myScrollBar.setHeight( 106 ); myScrollBar.setTop( 18 ); searchField = new MEGuiTextField( fontRendererObj, this.guiLeft + Math.max( 107, offsetX ), this.guiTop + 6, 64, fontRendererObj.FONT_HEIGHT ); searchField.setEnableBackgroundDrawing( false ); searchField.setMaxStringLength( 25 ); searchField.setTextColor( 0xFFFFFF ); searchField.setVisible( true ); searchField.setFocused( true ); }
Source:
<code><START> public HashMap<Component, List<Pair<Component, Integer>>> getFoundComponents() { <END> return foundComponents; }</code><technical_language>suggestion public Map<Component, List<Pair<Component, Integer>>> getFoundComponents() {</technical_language>

Target:
public Map<Component, List<Pair<Component, Integer>>> getFoundComponents() { return foundComponents; }