auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public GCModel read() throws IOException { getLogger().info("Reading Shenandoah format..."); GCModel model = new GCModel(); model.setFormat(GCModel.Format.RED_HAT_SHENANDOAH_GC); <START> Stream<String> lines = new BufferedReader(in).lines(); <END> lines.filter(this::lineNotInExcludedStrings) .map(this::parseShenandoahEvent) .filter(Objects::nonNull) .forEach(model::add); return model; }</code><technical_language>need wrap "in" in a BufferedReader. is a LineNumberReader, is a subclass of BufferedReader</technical_language>

Target:
public GCModel read() throws IOException { getLogger().info("Reading Shenandoah format..."); GCModel model = new GCModel(); model.setFormat(GCModel.Format.RED_HAT_SHENANDOAH_GC); Stream<String> lines = in.lines(); lines.filter(this::lineNotInExcludedStrings) .map(this::parseShenandoahEvent) .filter(Objects::nonNull) .forEach(model::add); return model; }
Source:
<code>private static CompletionParams getCompletionParams(String buf, int cursor) { final int actualCursor = Math.min(cursor, buf.length()); final String beforeCursor = buf.substring(0, actualCursor); final int line = countLines(beforeCursor) - 1; final int character = beforeCursor.length() - beforeCursor.lastIndexOf("\n") - 1; <START> Logger.info("Line: {}, character: from actual cursor: ", line, character, cursor); <END> return new CompletionParams( new TextDocumentIdentifier(ANY_URI), new Position(line, character)); }</code><technical_language>change debug level</technical_language>

Target:
private static CompletionParams getCompletionParams(String buf, int cursor) { final int actualCursor = Math.min(cursor, buf.length()); final String beforeCursor = buf.substring(0, actualCursor); final int line = countLines(beforeCursor) - 1; final int character = beforeCursor.length() - beforeCursor.lastIndexOf("\n") - 1; Logger.debug("Line: {}, character: from actual cursor: ", line, character, cursor); return new CompletionParams( new TextDocumentIdentifier(ANY_URI), new Position(line, character)); }
Source:
<code>public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { <START> for (ArtifactCoordinates a : artifactCoordinates) { <END> isDependencyAllowed(a); } return true; }</code><technical_language>This is nice, collect dependencies allowed end throw exception allowed dependencies? user need build N times get time a failure for N allowed dependencies</technical_language>

Target:
public static Boolean areDependenciesAllowed(List<ArtifactCoordinates> artifactCoordinates) throws ValidationException { List<ArtifactCoordinates> notAllowedDependencies = collectNotAllowedDependencies(artifactCoordinates); if (!notAllowedDependencies.isEmpty()) { StringBuilder notAllowedMessage = new StringBuilder(); notAllowedDependencies.forEach(d -> notAllowedMessage.append(d.toString()).append(",")); throw new ValidationException("The following dependencies are not allowed unless their scope is [provided]: " + removeEnd(notAllowedMessage.toString(), ",")); } return true; }
Source:
<code>public String getIdForHolder() { if (this.getType() == MessageType.PRIVATE_MESSAGE) { return getRawRecipients(); } if(getStream() == null) { <START> String k = ""; <END> } return getStream().getId() + getSubject(); }</code><technical_language>is this for? a no-op</technical_language>

Target:
public String getIdForHolder() { if (this.getType() == MessageType.PRIVATE_MESSAGE) { return getRawRecipients(); } return getStream().getId() + getSubject(); }
Source:
<code>String plainId() { <START> return "[R" + id + "]"; <END> }</code><technical_language>"]" a char</technical_language>

Target:
String plainId() { return "[R" + id + ']'; }
Source:
<code>private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { PhoneAccountHandle phoneAccountFromNumber = null; <START> Cursor cursor = null; cursor = <END> mContentResolver.query(Calls.CONTENT_URI, new String[] {Calls.PHONE_ACCOUNT_ID, Calls.PHONE_ACCOUNT_COMPONENT_NAME}, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor != null) { if (cursor.getCount() > 0) { cursor.moveToNext(); String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); if (!TextUtils.isEmpty(componentName) && !TextUtils.isEmpty(accountId)) { phoneAccountFromNumber = new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); } } cursor.close(); } return phoneAccountFromNumber; }</code><technical_language>declaration assignment combined</technical_language>

Target:
private PhoneAccountHandle getAccountHandleFromNumber(String dialNumber) { Cursor cursor = mContentResolver.query(Calls.CONTENT_URI, new String[] {Calls.PHONE_ACCOUNT_ID, Calls.PHONE_ACCOUNT_COMPONENT_NAME}, Calls.TYPE + "=" + Calls.OUTGOING_TYPE + " AND " + Calls.NUMBER + "=\"" + PhoneNumberUtils.normalizeNumber(dialNumber) + "\"", null, Calls.DEFAULT_SORT_ORDER + " LIMIT 1"); if (cursor == null) { return null; } if (cursor.getCount() > 0) { cursor.moveToNext(); String componentName = cursor.getString( cursor.getColumnIndex(Calls.PHONE_ACCOUNT_COMPONENT_NAME)); String accountId = cursor.getString(cursor.getColumnIndex(Calls.PHONE_ACCOUNT_ID)); cursor.close(); if (!TextUtils.isEmpty(componentName) && !TextUtils.isEmpty(accountId)) { return new PhoneAccountHandle( ComponentName.unflattenFromString(componentName), accountId); } } return null; }
Source:
<code><START> private String getPropertiesString(Map<String, Object> properties) { <END> StringBuilder output = new StringBuilder(); for (Entry<String, Object> entry : properties.entrySet()) { if (entry.getKey().equals("spring.profiles")) { continue; } if (output.length() > 0) { output.append("\n"); } String line = entry.getKey() + ": " + entry.getValue(); output.append(line); } return output.toString(); }</code><technical_language>remove sort</technical_language>

Target:
private String getPropertiesString(Map<String, Object> properties) { StringBuilder output = new StringBuilder(); for (Entry<String, Object> entry : properties.entrySet()) { if (output.length() > 0) { output.append("\n"); } String line = entry.getKey() + ": " + entry.getValue(); output.append(line); } return output.toString(); }
Source:
<code>public boolean getEnabled(String actionCommand) { <START> if (ActionNames.ADD.equals(actionCommand)) <END> return guiComp.canBeAdded(); else return true; }</code><technical_language>Please braces. Checkstyle pick this up</technical_language>

Target:
public boolean getEnabled(String actionCommand) { if (ActionNames.ADD.equals(actionCommand)) { return guiComp.canBeAdded(); } else { return true; } }
Source:
<code>public List<String> getTags() { if (tags == null) { <START> return new ArrayList<>(); <END> } return tags; }</code><technical_language>assigned</technical_language>

Target:
public List<String> getTags() { if (tags == null) { tags = new ArrayList<>(); } return tags; }
Source:
<code>public void swap(INDArray x, INDArray y) { if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL) OpProfiler.getInstance().processBlasCall(false, x, y); if(x.isSparse() || y.isSparse()) { <START> Nd4j.getSparseBlasWrapper().level1().swap(x, y); <END> } if (x.data().dataType() == DataBuffer.Type.DOUBLE) { DefaultOpExecutioner.validateDataType(DataBuffer.Type.DOUBLE, x, y); dswap(x.length(), x, BlasBufferUtil.getBlasStride(x), y, BlasBufferUtil.getBlasStride(y)); } else { DefaultOpExecutioner.validateDataType(DataBuffer.Type.FLOAT, x, y); sswap(x.length(), x, BlasBufferUtil.getBlasStride(x), y, BlasBufferUtil.getBlasStride(y)); } }</code><technical_language>Needs a return statement</technical_language>

Target:
public void swap(INDArray x, INDArray y) { if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL) OpProfiler.getInstance().processBlasCall(false, x, y); if (x.isSparse() || y.isSparse()) { Nd4j.getSparseBlasWrapper().level1().swap(x, y); return; } if (x.data().dataType() == DataBuffer.Type.DOUBLE) { DefaultOpExecutioner.validateDataType(DataBuffer.Type.DOUBLE, x, y); dswap(x.length(), x, BlasBufferUtil.getBlasStride(x), y, BlasBufferUtil.getBlasStride(y)); } else { DefaultOpExecutioner.validateDataType(DataBuffer.Type.FLOAT, x, y); sswap(x.length(), x, BlasBufferUtil.getBlasStride(x), y, BlasBufferUtil.getBlasStride(y)); } }
Source:
<code>public synchronized void run() { try { if (connection == null) { log.warn("MBean connection is not open, cannot read open files stats"); return; } OperatingSystemMXBean osBean = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class); Long openFiles = (Long) connection.getAttribute(osBean.getObjectName(), OPEN_FILE_DESCRIPTOR_COUNT); Long maxOpenFiles = (Long) connection.getAttribute(osBean.getObjectName(), MAX_FILE_DESCRIPTOR_COUNT); if (openFiles != null) { timeline.addValue(OPEN_FILES, new Timeline.Value(openFiles)); } log.tracef("Open files: open=%s, max=%s", openFiles, maxOpenFiles); } catch (Exception e) { <START> log.error("Error in JMX memory stats retrieval", e); <END> } }</code><technical_language>open files</technical_language>

Target:
public synchronized void run() { try { if (connection == null) { log.warn("MBean connection is not open, cannot read open files stats"); return; } OperatingSystemMXBean osBean = ManagementFactory.newPlatformMXBeanProxy(connection, ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME, OperatingSystemMXBean.class); Long openFiles = (Long) connection.getAttribute(osBean.getObjectName(), OPEN_FILE_DESCRIPTOR_COUNT); Long maxOpenFiles = (Long) connection.getAttribute(osBean.getObjectName(), MAX_FILE_DESCRIPTOR_COUNT); if (openFiles != null) { timeline.addValue(OPEN_FILES, new Timeline.Value(openFiles)); } log.tracef("Open files: open=%s, max=%s", openFiles, maxOpenFiles); } catch (Exception e) { log.error("Error in open files stats retrieval", e); } }
Source:
<code>public <START> List<SCTVerificationResult> <END> getValidSCTs() { return Collections.unmodifiableList(validSCTs); }</code><technical_language>order matter, initialize validSCTs a frozenset copy time getValidSCTs is called</technical_language>

Target:
public List<VerifiedSCT> getValidSCTs() { return Collections.unmodifiableList(validSCTs); }
Source:
<code>public void updateHosts() { <START> UpdateExternalHostModels(); <END> updateHostList(getProviderSearchFilter().getEntity()); }</code><technical_language>lower-case 'u'</technical_language>

Target:
public void updateHosts() { updateExternalHostModels(); updateHostList(getProviderSearchFilter().getEntity()); }
Source:
<code>private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> image.setActualSizeInBytes(image.getSize())); <START> getVm().getImages().forEach(image -> image.setVolumeType(VolumeType.Preallocated)); <END> } }</code><technical_language>forEach, call function time</technical_language>

Target:
private void adjustKVMDataForBlockSD() { if (getVm().getOrigin() == OriginType.KVM && getActionState() == CommandActionState.EXECUTE && getStorageDomain() != null && getStorageDomain().getStorageType().isBlockDomain()) { getVm().getImages().forEach(image -> { image.setActualSizeInBytes(image.getSize()); image.setVolumeType(VolumeType.Preallocated); }); } }
Source:
<code>public Enum<?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String text = jp.getText().toUpperCase(); try { Method valueOfMethod = handledType().getDeclaredMethod("valueOf", String.class); return (Enum<?>) valueOfMethod.invoke(null, text); } catch (Exception e) { throw new RuntimeException("Cannot deserialize enum " + handledType().getName() + " from " + text, e); <START> } <END> }</code><technical_language>compilation error for Enum.valueOf()? If I guess, guess need cast handledType() a Class<? extends Enum<?>> similar. confused "adds endpoint failed exception". I tell, IllegalArgumentException JsonProcessingException accurately specifically label this exception</technical_language>

Target:
public Enum<?> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String text = jp.getText().toUpperCase(); return (Enum<?>) Enum.valueOf((Class<Enum>)handledType(), text); }
Source:
<code>public OnmsTopology buildTopology() { final OnmsTopology topology = new OnmsTopology(); final List<UserDefinedLink> udls = udlTopologyService.findAllUserDefinedLinks(); final Set<Integer> referencedNodes = new HashSet<>(); referencedNodes.addAll(udls.stream() .map(UserDefinedLink::getNodeIdA) .collect(Collectors.toSet())); referencedNodes.addAll(udls.stream() .map(UserDefinedLink::getNodeIdZ) .collect(Collectors.toSet())); final Map<Integer, NodeTopologyEntity> nodeMap = getNodeMap(); final Map<Integer, IpInterfaceTopologyEntity> ipMap = getIpPrimaryMap(); final Map<Integer, OnmsTopologyVertex> nodeVertexMap = new LinkedHashMap<>(); for (Integer nodeId: referencedNodes) { final OnmsTopologyVertex nodeVertex = create(nodeMap.get(nodeId), ipMap.get(nodeId)); nodeVertexMap.put(nodeId, nodeVertex); <START> topology.addVertex(create(nodeMap.get(nodeId), ipMap.get(nodeId))); <END> } for (UserDefinedLink udl : udls) { final String uniqueLinkId = Integer.toString(udl.getDbId()); final OnmsTopologyPort sourcePort = OnmsTopologyPort.create(uniqueLinkId + "|A", nodeVertexMap.get(udl.getNodeIdA()), null); sourcePort.setToolTipText(udl.getComponentLabelA()); final OnmsTopologyPort targetPort = OnmsTopologyPort.create(uniqueLinkId + "|Z", nodeVertexMap.get(udl.getNodeIdZ()), null); targetPort.setToolTipText(udl.getComponentLabelZ()); final OnmsTopologyEdge edge = OnmsTopologyEdge.create(uniqueLinkId, sourcePort, targetPort); edge.setToolTipText(udl.getLinkLabel()); topology.addEdge(edge); } return topology; }</code><technical_language>suggestion topology.addVertex(nodeVertex);</technical_language>

Target:
public OnmsTopology buildTopology() { final OnmsTopology topology = new OnmsTopology(); final List<UserDefinedLink> udls = udlTopologyService.findAllUserDefinedLinks(); final Set<Integer> referencedNodes = new HashSet<>(); referencedNodes.addAll(udls.stream() .map(UserDefinedLink::getNodeIdA) .collect(Collectors.toSet())); referencedNodes.addAll(udls.stream() .map(UserDefinedLink::getNodeIdZ) .collect(Collectors.toSet())); final Map<Integer, NodeTopologyEntity> nodeMap = getNodeMap(); final Map<Integer, IpInterfaceTopologyEntity> ipMap = getIpPrimaryMap(); final Map<Integer, OnmsTopologyVertex> nodeVertexMap = new LinkedHashMap<>(); for (Integer nodeId: referencedNodes) { final OnmsTopologyVertex nodeVertex = create(nodeMap.get(nodeId), ipMap.get(nodeId)); nodeVertexMap.put(nodeId, nodeVertex); topology.addVertex(nodeVertex); } for (UserDefinedLink udl : udls) { final String uniqueLinkId = Integer.toString(udl.getDbId()); final OnmsTopologyPort sourcePort = OnmsTopologyPort.create(uniqueLinkId + "|A", nodeVertexMap.get(udl.getNodeIdA()), null); sourcePort.setToolTipText(udl.getComponentLabelA()); final OnmsTopologyPort targetPort = OnmsTopologyPort.create(uniqueLinkId + "|Z", nodeVertexMap.get(udl.getNodeIdZ()), null); targetPort.setToolTipText(udl.getComponentLabelZ()); final OnmsTopologyEdge edge = OnmsTopologyEdge.create(uniqueLinkId, sourcePort, targetPort); edge.setToolTipText(udl.getLinkLabel()); topology.addEdge(edge); } return topology; }
Source:
<code>public Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader, Method factoryMarkedAnnotation) throws Exception; public boolean supportsStatics(); public void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException; public void setInternalProxies(ModContainer mod, Side side, ClassLoader loader); public default Function<FMLEvent, CompletableFuture<Void>> createEventHandler(Method method) { return event -> { CompletableFuture<Void> future = new CompletableFuture<>(); try { if (CompletionStage.class.isAssignableFrom(method.getReturnType())) { ((CompletionStage<Void>) method.invoke(event)).whenComplete((value, throwable) -> { if (throwable != null) { future.completeExceptionally(throwable); } else { future.complete(value); } }); } else { <START> method.invoke(event); <END> future.complete(null); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { future.completeExceptionally(exception); } return future; }; }</code><technical_language>invocation needs a mod instance, I</technical_language>

Target:
Object getNewInstance(FMLModContainer container, Class<?> objectClass, ClassLoader classLoader, Method factoryMarkedAnnotation) throws Exception; boolean supportsStatics(); void setProxy(Field target, Class<?> proxyTarget, Object proxy) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException; void setInternalProxies(ModContainer mod, Side side, ClassLoader loader); default BiFunction<Object, FMLEvent, CompletableFuture<Void>> createEventHandler(Method method) { return (Object mod, FMLEvent event) -> { CompletableFuture<Void> future = new CompletableFuture<>(); try { if (CompletionStage.class.isAssignableFrom(method.getReturnType())) { ((CompletionStage<Void>) method.invoke(mod, event)).whenComplete((value, throwable) -> { if (throwable != null) { future.completeExceptionally(throwable); } else { future.complete(value); } }); } else { method.invoke(mod, event); future.complete(null); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { future.completeExceptionally(exception); } return future; }; }
Source:
<code>public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.content_frame); setBehindContentView(R.layout.menu_frame); switchFragment(getString(R.string.menu), false); switchActiveContent(getString(R.string.playlist)); setTitle(getString(R.string.playlist)); <START> getSlidingMenu().setBehindOffset(60); <END> setSlidingActionBarEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getString(R.string.playlist)); CustomApp curApp = ((CustomApp)getApplication()); curApp.getUserList().addUser(BluetoothUtils.getLocalBluetoothName()); }</code><technical_language>Magic number</technical_language>

Target:
public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.content_frame); setBehindContentView(R.layout.menu_frame); switchFragment(getString(R.string.menu), false); switchActiveContent(getString(R.string.playlist)); setTitle(getString(R.string.playlist)); getSlidingMenu().setBehindOffsetRes(R.dimen.show_content); setSlidingActionBarEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(getString(R.string.playlist)); CustomApp curApp = ((CustomApp)getApplication()); curApp.getUserList().addUser(BluetoothUtils.getLocalBluetoothName()); }
Source:
<code>protected Object visitCoalesceExpression(CoalesceExpression node, Object context) { Type type = type(node); List<Object> values = node.getOperands().stream() .map(value -> processWithExceptionHandling(value, context)) .filter(Objects::nonNull) .collect(Collectors.toList()); if ((!values.isEmpty() && !(values.get(0) instanceof Expression)) || values.size() == 1) { return values.get(0); } <START> HashSet<Expression> visitExpression = new HashSet<>(); <END> List<Expression> expressions = values.stream() .map(value -> toExpression(value, type)) .filter(x -> !visitExpression.contains(x)) .peek(visitExpression::add) .collect(Collectors.toList()); if (expressions.isEmpty()) { return null; } if (expressions.size() == 1 || expressions.get(0) instanceof Literal) { return expressions.get(0); } return new CoalesceExpression(expressions); }</code><technical_language>Declare Set</technical_language>

Target:
protected Object visitCoalesceExpression(CoalesceExpression node, Object context) { Type type = type(node); List<Object> values = node.getOperands().stream() .map(value -> processWithExceptionHandling(value, context)) .filter(Objects::nonNull) .flatMap(expression -> { if (expression instanceof CoalesceExpression) { return ((CoalesceExpression) expression).getOperands().stream(); } return Stream.of(expression); }) .collect(Collectors.toList()); if ((!values.isEmpty() && !(values.get(0) instanceof Expression)) || values.size() == 1) { return values.get(0); } ImmutableList.Builder<Expression> operandsBuilder = ImmutableList.builder(); Set<Expression> visitedExpression = new HashSet<>(); for (Object value : values) { Expression expression = toExpression(value, type); if (!isDeterministic(expression) || visitedExpression.add(expression)) { operandsBuilder.add(expression); } if (expression instanceof Literal) { break; } } List<Expression> expressions = operandsBuilder.build(); if (expressions.isEmpty()) { return null; } if (expressions.size() == 1) { return getOnlyElement(expressions); } return new CoalesceExpression(expressions); }
Source:
<code>public void init() throws IOException { pinotCrypter = new NoOpPinotCrypter(); <START> srcFile = File.createTempFile("srcFile","txt"); <END> srcFile.deleteOnExit(); destinationFile = File.createTempFile("destFile","txt"); destinationFile.deleteOnExit(); FileUtils.write(srcFile,"testData"); }</code><technical_language>names encryptedFile decryptedFile for readability</technical_language>

Target:
public void init() throws IOException { pinotCrypter = new NoOpPinotCrypter(); srcFile = File.createTempFile("srcFile","txt"); encryptedFile = File.createTempFile("encryptedFile","txt"); encryptedFile.deleteOnExit(); decryptedFile = File.createTempFile("decryptedFile","txt"); decryptedFile.deleteOnExit(); FileUtils.write(srcFile,"testData"); }
Source:
<code>public List<CommonCourtJudgment> generateCcJudgments(int count) { CommonCourt commonCourt = testPersistenceObjectFactory.createCcCourt(CommonCourtType.DISTRICT); CommonCourt[] commonCourts = new CommonCourt[] {commonCourt, commonCourt.getRegionalCourt(), commonCourt.getAppealCourt()}; List<CommonCourtJudgment> ccJudgments = testPersistenceObjectFactory.createCcJudgmentListWithRandomData(count); int i = 0; for (CommonCourtJudgment ccJudgment : ccJudgments) { <START> ccJudgment.setCourtDivision(commonCourts[i % 2].getDivisions().get(0)); <END> i++; } judgmentRepository.save(ccJudgments); judgmentRepository.flush(); return ccJudgments; }</code><technical_language>Table commonCourts elements, two</technical_language>

Target:
public List<CommonCourtJudgment> generateCcJudgments(int count) { CommonCourt commonCourt = testPersistenceObjectFactory.createCcCourt(CommonCourtType.DISTRICT); CommonCourt[] commonCourts = new CommonCourt[] {commonCourt, commonCourt.getRegionalCourt(), commonCourt.getAppealCourt()}; List<CommonCourtJudgment> ccJudgments = testPersistenceObjectFactory.createCcJudgmentListWithRandomData(count); int i = 0; for (CommonCourtJudgment ccJudgment : ccJudgments) { ccJudgment.setCourtDivision(commonCourts[i % 3].getDivisions().get(0)); i++; } judgmentRepository.save(ccJudgments); judgmentRepository.flush(); return ccJudgments; }
Source:
<code>protected boolean connect() throws IOException { <START> if (isConnected()) { <END> return false; } if (super.connect()) { this.sslEngine = sslContext.createSSLEngine(); this.sslEngine.setUseClientMode(true); this.sslSession = sslEngine.getSession(); sslEngine.beginHandshake(); doHandshake(channel(), sslEngine, ByteBuffer.allocate(sslSession.getPacketBufferSize()), ByteBuffer.allocate(sslSession.getPacketBufferSize())); } return false; }</code><technical_language>This check is superfluous super.connect() check. safely remove this if block here</technical_language>

Target:
protected boolean connect() throws IOException { if (super.connect()) { this.sslEngine = sslContext.createSSLEngine(); this.sslEngine.setUseClientMode(true); this.sslSession = sslEngine.getSession(); sslEngine.beginHandshake(); doHandshake(channel(), sslEngine, ByteBuffer.allocate(sslSession.getPacketBufferSize()), ByteBuffer.allocate(sslSession.getPacketBufferSize())); } return false; }
Source:
<code>private static void setIconHotSpot(XmlPullParser parser, KmlStyle style) { float xValue, yValue; String xUnits, yUnits; <START> if (TextUtils.isEmpty(parser.getAttributeValue(null, "x")) || <END> TextUtils.isEmpty(parser.getAttributeValue(null, "y"))) { return; } xValue = Float.parseFloat(parser.getAttributeValue(null, "x")); yValue = Float.parseFloat(parser.getAttributeValue(null, "y")); xUnits = parser.getAttributeValue(null, "xunits"); yUnits = parser.getAttributeValue(null, "yunits"); style.setHotSpot(xValue, yValue, xUnits, yUnits); }</code><technical_language>if early return checks if method [XmlPullParser.isEmptyElementTag](<LINK_0> is true intent is clearer</technical_language>

Target:
private static void setIconHotSpot(XmlPullParser parser, KmlStyle style) throws XmlPullParserException { if (parser.isEmptyElementTag()) { return; } float xValue, yValue; String xUnits, yUnits; xValue = Float.parseFloat(parser.getAttributeValue(null, "x")); yValue = Float.parseFloat(parser.getAttributeValue(null, "y")); xUnits = parser.getAttributeValue(null, "xunits"); yUnits = parser.getAttributeValue(null, "yunits"); style.setHotSpot(xValue, yValue, xUnits, yUnits); }
Source:
<code><START> public void reset() { <END> _startTime = 0L; _endTime = 0L; }</code><technical_language>this is public? Consider call sequence: 1. startMeasuringLatency() 2. reset() 3. endMeasuringLatency(), record a huge number latency</technical_language>

Target:
public void reset() { _startTime = VALUE_NOT_SET; _endTime = VALUE_NOT_SET; }
Source:
<code>public void setUp() throws Exception { createAccountingDocumentService = new TestCreateAccountingDocumentServiceImpl(buildMockPersonService()); createAccountingDocumentService.setAccountingDocumentBatchInputFileType(buildAccountingXmlDocumentInputFileType()); createAccountingDocumentService.setBatchInputFileService(new BatchInputFileServiceImpl()); createAccountingDocumentService.setFileStorageService(buildFileStorageService()); createAccountingDocumentService.setConfigurationService(buildMockConfigurationService()); createAccountingDocumentService.setDocumentService(buildMockDocumentService()); createAccountingDocumentService.setCreateAccountingDocumentReportSerivce(new TestCreateAccountingDocumentReportSerivce()); createAccountingDocumentService.setParameterService(buildParameterervice()); <START> <END> routedAccountingDocuments = new ArrayList<>(); creationOrderedBaseFileNames = new ArrayList<>(); createTargetTestDirectory(); }</code><technical_language>Is extra newline here</technical_language>

Target:
public void setUp() throws Exception { createAccountingDocumentService = new TestCreateAccountingDocumentServiceImpl(buildMockPersonService()); createAccountingDocumentService.setAccountingDocumentBatchInputFileType(buildAccountingXmlDocumentInputFileType()); createAccountingDocumentService.setBatchInputFileService(new BatchInputFileServiceImpl()); createAccountingDocumentService.setFileStorageService(buildFileStorageService()); createAccountingDocumentService.setConfigurationService(buildMockConfigurationService()); createAccountingDocumentService.setDocumentService(buildMockDocumentService()); createAccountingDocumentService.setCreateAccountingDocumentReportService(new TestCreateAccountingDocumentReportService()); createAccountingDocumentService.setParameterService(buildParameterService()); routedAccountingDocuments = new ArrayList<>(); creationOrderedBaseFileNames = new ArrayList<>(); createTargetTestDirectory(); }
Source:
<code><START> private void collectDependencies() throws IOException, InterruptedException, NoSuchAlgorithmException { <END> backupModAnsSumFiles(); List<String> goModArgs = new ArrayList<>(); goModArgs.addAll(Arrays.asList(GO_MOD_GRAPH_CMD.split(" "))); CommandResults goGraphResult = runGoCmd(goModArgs); String cachePath = getCachePath(); String dependenciesGraph[] = goGraphResult.getRes().split("\\r?\\n"); for (String entry : dependenciesGraph) { String moduleToAdd = entry.split(" ")[1]; addModuleDependencies(moduleToAdd, cachePath); } restoreModAnsSumFiles(); }</code><technical_language>declare Exception thrown here</technical_language>

Target:
private void collectDependencies() throws Exception { backupModAnsSumFiles(); CommandResults goGraphResult = runGoCmd(GO_MOD_GRAPH_CMD); String cachePath = getCachePath(); String[] dependenciesGraph = goGraphResult.getRes().split("\\r?\\n"); for (String entry : dependenciesGraph) { String moduleToAdd = entry.split(" ")[1]; addModuleDependencies(moduleToAdd, cachePath); } restoreModAnsSumFiles(); }
Source:
<code>public static void openConsole(File file) throws IOException { if (file == null) { return; } String absolutePath = file.toPath().toAbsolutePath().getParent().toString(); boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_CONSOLE_APPLICATION); if (usingDefault) { NATIVE_DESKTOP.openConsole(absolutePath); } else { String command = Globals.prefs.get(JabRefPreferences.CONSOLE_COMMAND); command = command.trim(); if (!command.isEmpty()) { command = command.replaceAll("\\s+", " "); String[] subcommands = command.split(" "); String commandLoggingText = command.replace("%DIR", absolutePath); JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Executing command \"%0\"...", commandLoggingText)); LOGGER.info("Executing command \"" + commandLoggingText + "\"..."); try { new ProcessBuilder(subcommands).start(); } catch (IOException exception) { LOGGER.error("Open console", exception); JOptionPane.showMessageDialog(null, Localization.lang("Error occured while executing the command \"%0\".", commandLoggingText), Localization.lang("Open console") + " - " + Localization.lang("Error"), JOptionPane.ERROR_MESSAGE); <START> } <END> } } }</code><technical_language>I forgot convert swing dialog here. please fix this well? dialogService.showErrorDialog work Thanks</technical_language>

Target:
public static void openConsole(File file) throws IOException { if (file == null) { return; } String absolutePath = file.toPath().toAbsolutePath().getParent().toString(); boolean usingDefault = Globals.prefs.getBoolean(JabRefPreferences.USE_DEFAULT_CONSOLE_APPLICATION); if (usingDefault) { NATIVE_DESKTOP.openConsole(absolutePath); } else { String command = Globals.prefs.get(JabRefPreferences.CONSOLE_COMMAND); command = command.trim(); if (!command.isEmpty()) { command = command.replaceAll("\\s+", " "); String[] subcommands = command.split(" "); String commandLoggingText = command.replace("%DIR", absolutePath); JabRefGUI.getMainFrame().getDialogService().notify(Localization.lang("Executing command \"%0\"...", commandLoggingText)); LOGGER.info("Executing command \"" + commandLoggingText + "\"..."); try { new ProcessBuilder(subcommands).start(); } catch (IOException exception) { LOGGER.error("Open console", exception); JabRefGUI.getMainFrame().getDialogService().showErrorDialogAndWait( Localization.lang("Open console") + " - " + Localization.lang("Error", Localization.lang("Error occured while executing the command \"%0\".", commandLoggingText))); } } } }
Source:
<code>private void handleDescription(List<Field<String>> descriptionList, DocumentMetadata.Builder metaBuilder) { <START> if (CollectionUtils.isNotEmpty(descriptionList)) { for (Field<String> currentDescription : descriptionList) { if (fieldApprover.approve(currentDescription.getDataInfo()) && StringUtils.isNotBlank(currentDescription.getValue()) && !NULL_STRING_VALUE.equals(currentDescription.getValue())) { <END> metaBuilder.setAbstract$(currentDescription.getValue()); break; } } } }</code><technical_language>I stream iteration java titleList.stream() .filter(x -> fieldApprover.approve(x.getDataInfo())) .findFirst() .ifPresent(x -> metaBuilder.setTitle(x.getValue()));</technical_language>

Target:
private void handleDescription(List<Field<String>> descriptionList, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(descriptionList)) { descriptionList.stream().filter(x -> fieldApprover.approve(x.getDataInfo())) .filter(x -> StringUtils.isNotBlank(x.getValue())) .filter(x -> !NULL_STRING_VALUE.equals(x.getValue())).findFirst() .ifPresent(x -> metaBuilder.setAbstract$(x.getValue())); } }
Source:
<code>protected void upgradeComplete() { <START> health += 10; <END> maxHealth += 10; radius = upgradeRadius[upgradeLevel]; capacity = upgradeCapacities[upgradeLevel]; }</code><technical_language>this some conflicts.. do is put this maxHealth is upgraded, health = maxHealth (like stated @Borsty)</technical_language>

Target:
protected void upgradeComplete() { maxHealth += 10; health = maxHealth; radius = upgradeRadius[upgradeLevel]; capacity = upgradeCapacities[upgradeLevel]; }
Source:
<code>public boolean validate() { if (getDiskStorageType().getEntity() == DiskStorageType.LUN && getSanStorageModelBase() != null) { getSanStorageModelBase().validate(); if (!getSanStorageModelBase().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModelBase().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModelBase().isForce()) { if <START> (!isForceCreationWarningCreated) { <END> forceCreationWarning(partOfSdLunsMessages); isForceCreationWarningCreated = true; } return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); IntegerValidation sizeValidation = new IntegerValidation(); sizeValidation.setMinimum(getMinimumDiskSize()); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxBlockDiskSizeInGibiBytes)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }</code><technical_language>If omit /costumize validate() store() flush() I suggest adding beggining of AbstractDiskModel#forceCreationWarning(): if (getConfirmWindow() != null) { return; } This prevent creating confirmation windows new variable</technical_language>

Target:
public boolean validate() { if (getDiskStorageType().getEntity() == DiskStorageType.LUN && getSanStorageModelBase() != null) { getSanStorageModelBase().validate(); if (!getSanStorageModelBase().getIsValid()) { return false; } ArrayList<String> partOfSdLunsMessages = getSanStorageModelBase().getPartOfSdLunsMessages(); if (!partOfSdLunsMessages.isEmpty() && !getSanStorageModelBase().isForce()) { forceCreationWarning(partOfSdLunsMessages); return false; } } StorageType storageType = getStorageDomain().getSelectedItem() == null ? StorageType.UNKNOWN : getStorageDomain().getSelectedItem().getStorageType(); IntegerValidation sizeValidation = new IntegerValidation(); sizeValidation.setMinimum(getMinimumDiskSize()); if (storageType.isBlockDomain()) { sizeValidation.setMaximum((Integer) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.MaxBlockDiskSizeInGibiBytes)); } getSize().validateEntity(new IValidation[] { new NotEmptyValidation(), sizeValidation }); getStorageDomain().validateSelectedItem(new IValidation[] { new NotEmptyValidation() }); return super.validate() && getSize().getIsValid() && getStorageDomain().getIsValid(); }
Source:
<code>private MyShowsClient(Context context) { this.context = context; this.api = new RestAdapter.Builder() .setEndpoint(API_URL) <START> .setLogLevel(RestAdapter.LogLevel.FULL) <END> .setRequestInterceptor(request -> request.addHeader("Cookie", TextUtils.join("; ", getCookies()))) .build() .create(MyShowsApi.class); }</code><technical_language>Condition logs</technical_language>

Target:
private MyShowsClient(Context context) { this.preferences = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE); this.api = new RestAdapter.Builder() .setEndpoint(API_URL) .setLogLevel(BuildConfig.DEBUG ? RestAdapter.LogLevel.FULL : RestAdapter.LogLevel.NONE) .setRequestInterceptor(request -> request.addHeader(COOKIE, TextUtils.join(COOKIE_DELIMITER, getCookies()))) .build() .create(MyShowsApi.class); }
Source:
<code>public ReplaceKeysResponse getReplaceKeysResponse(@RequestPayload final ReplaceKeysAsyncRequest request) throws OsgpException { ReplaceKeysResponse response = null; try { final ResponseData responseData = this.responseDataService.dequeue(request.getCorrelationUid(), ComponentType.WS_SMART_METERING); <START> this.throwExceptionIfResultNotOk(responseData, "replace keys on device"); <END> response = new ReplaceKeysResponse(); response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue())); if (responseData.getMessageData() instanceof String) { response.setDescription((String) responseData.getMessageData()); } } catch (final Exception e) { this.handleException(e); } return response; }</code><technical_language>If text is part of message for exception thrown follow "An exception occurred ". is formulated now, give a clean exception message. "replacing keys device" more in line this text is treated in other places throwExceptionIfResultNotOk is called</technical_language>

Target:
public ReplaceKeysResponse getReplaceKeysResponse(@RequestPayload final ReplaceKeysAsyncRequest request) throws OsgpException { ReplaceKeysResponse response = null; try { final ResponseData responseData = this.responseDataService.dequeue(request.getCorrelationUid(), ComponentType.WS_SMART_METERING); this.throwExceptionIfResultNotOk(responseData, "replacing keys on the device"); response = new ReplaceKeysResponse(); response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue())); if (responseData.getMessageData() instanceof String) { response.setDescription((String) responseData.getMessageData()); } } catch (final Exception e) { this.handleException(e); } return response; }
Source:
<code>public void determineProfileTest() { assertEquals(Profile.BIOLOGICAL_METRIC, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); <START> filter.setDataProfile("biologicalMetric"); <END> assertEquals(Profile.BIOLOGICAL_METRIC, controller.determineProfile(filter)); }</code><technical_language>throw a string in show calculate string. For example: ActivityControllerTest "biological" expects Profile.BIOLOGICAL returned - thought is technically valid for end point</technical_language>

Target:
public void determineProfileTest() { assertEquals(Profile.BIOLOGICAL_METRIC, controller.determineProfile(null)); FilterParameters filter = new FilterParameters(); filter.setDataProfile("biological"); assertEquals(Profile.BIOLOGICAL, controller.determineProfile(filter)); }
Source:
<code>public static String getString() { String returnString = ""; returnString += "\n\n---------------------------------------------------------------\n"; returnString += "OS_VERSION= " + System.getProperty("os.version") + "\n"; returnString += "RELEASE= " + Build.VERSION.RELEASE + "\n"; returnString += "DEVICE= " + Build.DEVICE + "\n"; returnString += "MODEL= " + Build.MODEL + "\n"; returnString += "PRODUCT= " + Build.PRODUCT + "\n"; returnString += "BRAND= " + Build.BRAND + "\n"; returnString += "DISPLAY= " + Build.DISPLAY + "\n"; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { returnString += "CPU_ABI= " + Build.CPU_ABI + "\n"; returnString += "CPU_ABI2= " + Build.CPU_ABI2 + "\n"; } else { returnString += "SUPPORTED_ABIS= " + TextUtils.join(", ", Build.SUPPORTED_ABIS) + "\n"; } returnString += "UNKNOWN= " + Build.UNKNOWN + "\n"; returnString += "HARDWARE= " + Build.HARDWARE + "\n"; returnString += "ID= " + Build.ID + "\n"; returnString += "MANUFACTURER= " + Build.MANUFACTURER + "\n"; <START> returnString += "USER= " + Build.USER + "\n"; <END> returnString += "HOST= " + Build.HOST + "\n"; return returnString; }</code><technical_language>Permission is required starting in O, check. perfectly fine removing altogether I serial valuable insight</technical_language>

Target:
public static String getString() { String returnString = ""; returnString += "\n\n---------------------------------------------------------------\n"; returnString += "OS_VERSION= " + System.getProperty("os.version") + "\n"; returnString += "RELEASE= " + Build.VERSION.RELEASE + "\n"; returnString += "DEVICE= " + Build.DEVICE + "\n"; returnString += "MODEL= " + Build.MODEL + "\n"; returnString += "PRODUCT= " + Build.PRODUCT + "\n"; returnString += "BRAND= " + Build.BRAND + "\n"; returnString += "DISPLAY= " + Build.DISPLAY + "\n"; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { returnString += "CPU_ABI= " + Build.CPU_ABI + "\n"; returnString += "CPU_ABI2= " + Build.CPU_ABI2 + "\n"; } else { returnString += "SUPPORTED_ABIS= " + TextUtils.join(", ", Build.SUPPORTED_ABIS) + "\n"; } returnString += "HARDWARE= " + Build.HARDWARE + "\n"; returnString += "ID= " + Build.ID + "\n"; returnString += "MANUFACTURER= " + Build.MANUFACTURER + "\n"; returnString += "USER= " + Build.USER + "\n"; returnString += "HOST= " + Build.HOST + "\n"; return returnString; }
Source:
<code>public ParseTexResultViewModel(TexParserResult texParserResult) { this.referenceList = FXCollections.observableArrayList(); this.citationList = FXCollections.observableArrayList(); <START> texParserResult.getCitationsKeySet().forEach(key -> referenceList.add( <END> new ReferenceWrapper(key, texParserResult.getCitationsByKey(key)))); }</code><technical_language>Performancewise if work citations map (instead of keys get citation for it). referenceList = getCitations().stream().map(new ReferenceWrapper(...))) works</technical_language>

Target:
public ParseTexResultViewModel(TexParserResult texParserResult) { this.referenceList = FXCollections.observableArrayList(); this.citationList = FXCollections.observableArrayList(); texParserResult.getCitations() .asMap() .forEach((entry, citations) -> referenceList.add(new ReferenceViewModel(entry, citations))); }
Source:
<code>public Environment findOne(String application, String profile, String label) { if (StringUtils.isEmpty(label)) { label = "master"; } if (StringUtils.isEmpty(profile)) { profile = "default"; } if (!profile.startsWith("default")) { profile = "default," + profile; } String[] profiles = StringUtils.commaDelimitedListToStringArray(profile); Environment result = new Environment(application, profile, label, null, null); if (tokenMandatory) { if (accessStrategy.checkRemotePermissions()) { <START> addPropertySource(application, profiles, result); <END> } } else { addPropertySource(application, profiles, result); } return result; }</code><technical_language>Typically, check for <applicationname>-<profile>, <applicationname>, application-<profile> application. <profile> check profile a comma separated list. this do that</technical_language>

Target:
public Environment findOne(String application, String profile, String label) { if (StringUtils.isEmpty(label)) { label = "master"; } if (StringUtils.isEmpty(profile)) { profile = "default"; } if (!profile.startsWith("default")) { profile = "default," + profile; } String[] profiles = org.springframework.util.StringUtils .trimArrayElements(org.springframework.util.StringUtils.commaDelimitedListToStringArray(profile)); Environment result = new Environment(application, profile, label, null, null); if (tokenMandatory) { if (accessStrategy.checkRemotePermissions()) { addPropertySource(application, profiles, result); } } else { addPropertySource(application, profiles, result); } return result; }
Source:
<code>public void start() { if(State.NOT_STARTED.equals(this.state)) { logger.debug("Transcriber is now transcribing"); this.state = State.TRANSCRIBING; this.executorService = Executors.newSingleThreadExecutor(); List<String> names = new ArrayList<>(participants.size()); participants.values().forEach((p) -> names.add(p.getName())); <START> this.transcript.started(roomName, names); <END> } else { logger.warn("Trying to start Transcriber while it is" + "already started"); } }</code><technical_language>list participants, a name listed IDs. handle this modifying Participant#getName, handle here</technical_language>

Target:
public void start() { if(State.NOT_STARTED.equals(this.state)) { logger.debug("Transcriber is now transcribing"); this.state = State.TRANSCRIBING; this.executorService = Executors.newSingleThreadExecutor(); List<String> names = new ArrayList<>(participants.size()); participants.values().forEach((p) -> { String name; if((name = p.getName()) == null) { name = p.getId(); } names.add(name); }); this.transcript.started(roomName, names); } else { logger.warn("Trying to start Transcriber while it is" + "already started"); } }
Source:
<code>private Optional<SequenceAndBound> getLearnedState(long seq) { if (seq <= PaxosAcceptor.NO_LOG_ENTRY) { return Optional.of(ImmutableSequenceAndBound.of(PaxosAcceptor.NO_LOG_ENTRY, 0L)); } PaxosResponses<PaxosLong> responses = PaxosQuorumChecker.collectQuorumResponses( ImmutableList.copyOf(learners), learner -> getLearnedValue(seq, learner), QUORUM_OF_ONE, executor, PaxosQuorumChecker.DEFAULT_REMOTE_REQUESTS_TIMEOUT); if (!responses.hasQuorum()) { return Optional.empty(); } <START> return Optional.of(ImmutableSequenceAndBound.of(seq, responses.getResponses().get(0).getValue())); <END> }</code><technical_language>Iterables.getFirst</technical_language>

Target:
private Optional<SequenceAndBound> getLearnedState(long seq) { if (seq <= PaxosAcceptor.NO_LOG_ENTRY) { return Optional.of(ImmutableSequenceAndBound.of(PaxosAcceptor.NO_LOG_ENTRY, 0L)); } PaxosResponses<PaxosLong> responses = PaxosQuorumChecker.collectQuorumResponses( ImmutableList.copyOf(learners), learner -> getLearnedValue(seq, learner), QUORUM_OF_ONE, executor, PaxosQuorumChecker.DEFAULT_REMOTE_REQUESTS_TIMEOUT); return Optional.ofNullable(Iterables.getFirst(responses.get(), null)) .map(PaxosLong::getValue) .map(value -> ImmutableSequenceAndBound.of(seq, value)); }
Source:
<code>public void testStrlen() { assertExpr("strlen(x)", 3L); assertExpr("strlen(nonexistent)", NullHandling.defaultLongValue()); <START> assertExprFail("strlen(a)", AssertionError.class, null); <END> }</code><technical_language>This test adjusted removed strlen change</technical_language>

Target:
public void testStrlen() { assertExpr("strlen(x)", 3L); assertExpr("strlen(nonexistent)", NullHandling.defaultLongValue()); }