auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private static void appendTimespans(RDF rdf, List<TimespanImpl> timespans) { if (timespans != null) { List<TimeSpanType> timespanList = new ArrayList<>(); for (Timespan ts : timespans) { TimeSpanType timeSpan = new TimeSpanType(); timeSpan.setAbout(ts.getAbout()); addAsList(timeSpan, AltLabel.class, ts.getAltLabel()); addAsObject(timeSpan, Begin.class, ts.getBegin()); addAsObject(timeSpan, End.class, ts.getEnd()); addAsList(timeSpan, HasPart.class, ts.getDctermsHasPart()); <START> addAsList(timeSpan, IsPartOf.class, ts.getIsPartOfArray()); <END> addAsList(timeSpan, Note.class, ts.getNote()); addAsList(timeSpan, SameAs.class, ts.getOwlSameAs()); addAsList(timeSpan, PrefLabel.class, ts.getPrefLabel()); timespanList.add(timeSpan); } rdf.setTimeSpanList(timespanList); } }</code><technical_language>please revert this change implement required method in entity api if required</technical_language>

Target:
private static void appendTimespans(RDF rdf, List<TimespanImpl> timespans) { if (timespans != null) { List<TimeSpanType> timespanList = new ArrayList<>(); for (Timespan ts : timespans) { TimeSpanType timeSpan = new TimeSpanType(); timeSpan.setAbout(ts.getAbout()); addAsList(timeSpan, AltLabel.class, ts.getAltLabel()); addAsObject(timeSpan, Begin.class, ts.getBegin()); addAsObject(timeSpan, End.class, ts.getEnd()); addAsList(timeSpan, HasPart.class, ts.getDctermsHasPart()); addAsList(timeSpan, IsPartOf.class, ts.getIsPartOf()); addAsList(timeSpan, Note.class, ts.getNote()); addAsList(timeSpan, SameAs.class, ts.getOwlSameAs()); addAsList(timeSpan, PrefLabel.class, ts.getPrefLabel()); timespanList.add(timeSpan); } rdf.setTimeSpanList(timespanList); } }
Source:
<code>public T set(int index, T element) { try { if (element.equals(this.get(index))) { return element; } T oldObject = null; if (comparingSet.add(element)) { oldObject = super.set(index, element); comparingSet.remove(oldObject); } return oldObject; } catch (IndexOutOfBoundsException ioobException) { <START> throw new IndexOutOfBoundsException(); <END> } }</code><technical_language>again: do create a new empty exception reuse one</technical_language>

Target:
public T set(int index, T element) { try { if (element.equals(this.get(index))) { return element; } T oldObject = null; if (comparingSet.add(element)) { oldObject = super.set(index, element); comparingSet.remove(oldObject); } return oldObject; } catch (IndexOutOfBoundsException ioobException) { throw ioobException; } }
Source:
<code>protected void open() { super.open(); this.waitUntil((driver) -> Boolean.TRUE .equals(this.getCommandExecutor().executeScript( <START> "return Array.from(document.getElementsByTagName('*')).some(x => x.shadowRoot !== null)"))); <END> }</code><technical_language>x => x.shadowRoot work in IE. run tests in : is write this cross-browser</technical_language>

Target:
protected void open() { super.open(); this.waitUntil((driver) -> Boolean.TRUE .equals(this.getCommandExecutor().executeScript( "return Array.prototype.slice.call(document.getElementsByTagName(\"*\")).some(function (x) { return !!x.shadowRoot })"))); }
Source:
<code>public ClusterConnectionStates(long reconnectBackoffMs, long reconnectBackoffMaxMs, long connectionSetupTimeoutMs, long connectionSetupTimeoutMaxMs, LogContext logContext) { this.log = logContext.logger(ClusterConnectionStates.class); this.reconnectBackoff = new GeometricProgression( <START> reconnectBackoffMs, 2, reconnectBackoffMaxMs, 0.2); <END> this.connectionSetupTimeout = new GeometricProgression( connectionSetupTimeoutMs, 2, connectionSetupTimeoutMaxMs, 0.2); this.nodeState = new HashMap<>(); this.connectingNodes = new HashSet<>(); }</code><technical_language>sure, reusing code, changing behaviour for backoff right</technical_language>

Target:
public ClusterConnectionStates(long reconnectBackoffMs, long reconnectBackoffMaxMs, long connectionSetupTimeoutMs, long connectionSetupTimeoutMaxMs, LogContext logContext) { this.log = logContext.logger(ClusterConnectionStates.class); this.reconnectBackoff = new GeometricProgression( reconnectBackoffMs, RECONNECT_BACKOFF_EXP_BASE, reconnectBackoffMaxMs, RECONNECT_BACKOFF_JITTER); this.connectionSetupTimeout = new GeometricProgression( connectionSetupTimeoutMs, CONNECTION_SETUP_TIMEOUT_EXP_BASE, connectionSetupTimeoutMaxMs, CONNECTION_SETUP_TIMEOUT_JITTER); this.nodeState = new HashMap<>(); this.connectingNodes = new HashSet<>(); }
Source:
<code>private String[] createInvalidParamsForProfileWithScriptInjection() { return new String[] { Const.ParamsNames.STUDENT_SHORT_NAME, "short%<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_PROFILE_EMAIL, "<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_PROFILE_INSTITUTION, "<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_NATIONALITY, "USA<script>alert(\"was here\");</script>", <START> Const.ParamsNames.STUDENT_GENDER, "FEMALE", <END> Const.ParamsNames.STUDENT_PROFILE_MOREINFO, "This is more info on me<script>alert(\"was here\");</script>" }; }</code><technical_language>This test case changed</technical_language>

Target:
private String[] createInvalidParamsForProfileWithScriptInjection() { return new String[] { Const.ParamsNames.STUDENT_SHORT_NAME, "short%<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_PROFILE_EMAIL, "<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_PROFILE_INSTITUTION, "<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_NATIONALITY, "USA<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_GENDER, "female<script>alert(\"was here\");</script>", Const.ParamsNames.STUDENT_PROFILE_MOREINFO, "This is more info on me<script>alert(\"was here\");</script>" }; }
Source:
<code>static int getEncodedSize(Collection<Cube> cubes) { int size = 0; <START> size += 3 * cubes.size(); END> for (Cube cube : cubes) { if (!cube.isEmpty()) { size += cube.getStorage().getData().getSerializedSize(); } if (cube.getStorage() != null) { size += cube.getStorage().getBlockLight().getData().length; if (cube.getWorld().provider.hasSkyLight()) { size += cube.getStorage().getSkyLight().getData().length; } } } size += 256 * Integer.BYTES * cubes.size(); for (Cube cube : cubes) { byte[] biomeArray = cube.getBiomeArray(); if (biomeArray == null) continue; size += biomeArray.length; } return size; }</code><technical_language>adding network incompatible change, a good idea encode more boolean flags byte[], potentially giving a add future changes. small amount of data worth optimization, allow add 5 new flags while allowing new clients join servers</technical_language>

Target:
static int getEncodedSize(Collection<Cube> cubes) { int size = 0; size += cubes.size(); for (Cube cube : cubes) { if (!cube.isEmpty()) { size += cube.getStorage().getData().getSerializedSize(); } if (cube.getStorage() != null) { size += cube.getStorage().getBlockLight().getData().length; if (cube.getWorld().provider.hasSkyLight()) { size += cube.getStorage().getSkyLight().getData().length; } } } size += 256 * Integer.BYTES * cubes.size(); for (Cube cube : cubes) { byte[] biomeArray = cube.getBiomeArray(); if (biomeArray == null) continue; size += biomeArray.length; } return size; }
Source:
<code>public void writeBlock(BlockEncodingSerde blockEncodingSerde, SliceOutput sliceOutput, Block block) { DictionaryBlock dictionaryBlock = (DictionaryBlock) block; dictionaryBlock = dictionaryBlock.compact(); int positionCount = dictionaryBlock.getPositionCount(); sliceOutput.appendInt(positionCount); Block dictionary = dictionaryBlock.getDictionary(); blockEncodingSerde.writeBlock(sliceOutput, dictionary); ImmutableIntArray ids = dictionaryBlock.getIds(); <START> writeIds(sliceOutput, ids.getArray(), ids.getOffset(), ids.getLength()); <END> sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getMostSignificantBits()); sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getLeastSignificantBits()); sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getSequenceId()); }</code><technical_language>SliceOutput handle more elements Slice? If not, this change here</technical_language>

Target:
public void writeBlock(BlockEncodingSerde blockEncodingSerde, SliceOutput sliceOutput, Block block) { DictionaryBlock dictionaryBlock = (DictionaryBlock) block; dictionaryBlock = dictionaryBlock.compact(); int positionCount = dictionaryBlock.getPositionCount(); sliceOutput.appendInt(positionCount); Block dictionary = dictionaryBlock.getDictionary(); blockEncodingSerde.writeBlock(sliceOutput, dictionary); sliceOutput.writeBytes(dictionaryBlock.getIds()); sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getMostSignificantBits()); sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getLeastSignificantBits()); sliceOutput.appendLong(dictionaryBlock.getDictionarySourceId().getSequenceId()); }
Source:
<code>public void setUp() { <START> bst = new BinarySearchTree<>(); <END> }</code><technical_language>I rename this binarySearchTree I find clearer. preference though, feel free leave is if prefer :)</technical_language>

Target:
public void setUp() { binarySearchTree = new BinarySearchTree<>(); }
Source:
<code>public void testWithNoNamespace() throws Exception { ActionChainResult result = new ActionChainResult(); result.setActionName("${actionName}"); String expectedActionName = "testActionName"; String expectedNamespace = "${1-1}"; Map<String, Object> values = new HashMap<>(); values.put("actionName", expectedActionName); ValueStack stack = ActionContext.getContext().getValueStack(); stack.push(values); Mock actionProxyMock = new Mock(ActionProxy.class); actionProxyMock.expect("execute"); actionProxyMock.expectAndReturn("getNamespace", expectedNamespace); actionProxyMock.expectAndReturn("getActionName", expectedActionName); actionProxyMock.expectAndReturn("getMethod", null); ActionProxy actionProxy = (ActionProxy) actionProxyMock.proxy(); ActionProxyFactory testActionProxyFactory = new NamespaceActionNameTestActionProxyFactory(expectedNamespace, expectedActionName, actionProxy); result.setActionProxyFactory(testActionProxyFactory); Mock invocationMock = new Mock(ActionInvocation.class); invocationMock.matchAndReturn("getProxy", actionProxy); invocationMock.matchAndReturn("getInvocationContext", ActionContext.getContext()); try { <START> ActionContext.bound(stack.getActionContext()); <END> result.execute((ActionInvocation) invocationMock.proxy()); actionProxyMock.verify(); } finally { ActionContext.clear(); } }</code><technical_language>candidate for bind() if method is created</technical_language>

Target:
public void testWithNoNamespace() throws Exception { ActionChainResult result = new ActionChainResult(); result.setActionName("${actionName}"); String expectedActionName = "testActionName"; String expectedNamespace = "${1-1}"; Map<String, Object> values = new HashMap<>(); values.put("actionName", expectedActionName); ValueStack stack = ActionContext.getContext().getValueStack(); stack.push(values); Mock actionProxyMock = new Mock(ActionProxy.class); actionProxyMock.expect("execute"); actionProxyMock.expectAndReturn("getNamespace", expectedNamespace); actionProxyMock.expectAndReturn("getActionName", expectedActionName); actionProxyMock.expectAndReturn("getMethod", null); ActionProxy actionProxy = (ActionProxy) actionProxyMock.proxy(); ActionProxyFactory testActionProxyFactory = new NamespaceActionNameTestActionProxyFactory(expectedNamespace, expectedActionName, actionProxy); result.setActionProxyFactory(testActionProxyFactory); Mock invocationMock = new Mock(ActionInvocation.class); invocationMock.matchAndReturn("getProxy", actionProxy); invocationMock.matchAndReturn("getInvocationContext", ActionContext.getContext()); try { ActionContext.bind(stack.getActionContext()); result.execute((ActionInvocation) invocationMock.proxy()); actionProxyMock.verify(); } finally { ActionContext.clear(); } }
Source:
<code>public void testRenderPlaceHolder() { final String placeHolder = "placeholder"; final GridRenderer renderer = mock(GridRenderer.class); final GridRendererTheme theme = mock(GridRendererTheme.class); final Text text = mock(Text.class); setup(Optional.empty()); when(context.getRenderer()).thenReturn(renderer); when(renderer.getTheme()).thenReturn(theme); when(theme.getPlaceholderText()).thenReturn(text); metaData.renderPlaceHolder(context, BLOCK_WIDTH, BLOCK_HEIGHT); <START> verify(text).setX(BLOCK_WIDTH / 2); <END> verify(text).setY(BLOCK_HEIGHT / 2); verify(text).setText(placeHolder); verify(text).setListening(false); }</code><technical_language><LINK_0> I understand concern updating test. if test of code is changed fail, is 'useful' test</technical_language>

Target:
public void testRenderPlaceHolder() { final GridRenderer renderer = mock(GridRenderer.class); final GridRendererTheme theme = mock(GridRendererTheme.class); final Text text = mock(Text.class); setup(Optional.empty()); when(context.getRenderer()).thenReturn(renderer); when(renderer.getTheme()).thenReturn(theme); when(theme.getPlaceholderText()).thenReturn(text); metaData.renderPlaceHolder(context, BLOCK_WIDTH, BLOCK_HEIGHT); verify(text).setX(BLOCK_WIDTH / 2); verify(text).setY(BLOCK_HEIGHT / 2); verify(text).setText(PLACEHOLDER); verify(text).setListening(false); }
Source:
<code>private ImmutableList<String> installRpmBased() { ImmutableList.Builder<String> commands = ImmutableList.<String>builder(); commands.add("curl <LINK_0> | sudo bash"); <START> commands.add("sudo yum install -y riak"); <END> return commands.build(); }</code><technical_language>Suggest .add(BashCommands.sudo("yum install -y riak")). If running root user, some VMs problems try execute sudo. sudo(...) method checking if user is root. applies for other of sudo</technical_language>

Target:
private ImmutableList<String> installRpmBased() { return ImmutableList.<String>builder() .add("curl <LINK_0> | " + BashCommands.sudo("bash")) .add(BashCommands.sudo("yum install -y riak")) .build(); }
Source:
<code><START> private String getArrayResourceMethodName(Element element) { <END> TypeMirror typeMirror = element.asType(); if (TypeKind.ARRAY.equals(typeMirror.getKind())) { ArrayType arrayType = (ArrayType) typeMirror; String componentType = arrayType.getComponentType().toString(); if ("java.lang.String".equals(componentType)) { return "getStringArray"; } else if ("int".equals(componentType)) { return "getIntArray"; } else if ("java.lang.CharSequence".equals(componentType)) { return "getTextArray"; } } else if (TYPED_ARRAY_TYPE.equals(typeMirror.toString())) { return "obtainTypedArray"; } return null; }</code><technical_language>+static</technical_language>

Target:
private static String getArrayResourceMethodName(Element element) { TypeMirror typeMirror = element.asType(); if (TYPED_ARRAY_TYPE.equals(typeMirror.toString())) { return "obtainTypedArray"; } if (TypeKind.ARRAY.equals(typeMirror.getKind())) { ArrayType arrayType = (ArrayType) typeMirror; String componentType = arrayType.getComponentType().toString(); if ("java.lang.String".equals(componentType)) { return "getStringArray"; } else if ("int".equals(componentType)) { return "getIntArray"; } else if ("java.lang.CharSequence".equals(componentType)) { return "getTextArray"; } } return null; }
Source:
<code>public void testListDatacenters() { <START> List<Datacenter> datacenters = api().listDatacenters().concat().toList(); <END> assertNotNull(datacenters); for (Datacenter datacenter : datacenters) { assertNotNull(datacenter); } }</code><technical_language>call toList(). copy elements a list, losing benefits of lazy loading page. a big deal in tests, pagination properly (this serves example for users)</technical_language>

Target:
public void testListDatacenters() { FluentIterable<Datacenter> datacenters = api().listDatacenters().concat(); assertNotNull(datacenters); for (Datacenter datacenter : datacenters) { assertNotNull(datacenter); } }
Source:
<code>public MongoDBQueryParsingResult getResult() { OgmEntityPersister entityPersister = (OgmEntityPersister) sessionFactory.getMetamodel().entityPersister( targetType ); Document query = appendDiscriminatorClause( entityPersister, builder.build() ); return new MongoDBQueryParsingResult( targetType, entityPersister.getTableName(), query, getProjectionDocument(), orderBy, unwinds, <START> count ); <END> }</code><technical_language>Wondering if I resolve Operation pass along</technical_language>

Target:
public MongoDBQueryParsingResult getResult() { OgmEntityPersister entityPersister = (OgmEntityPersister) sessionFactory.getMetamodel().entityPersister( targetType ); Document query = appendDiscriminatorClause( entityPersister, builder.build() ); return new MongoDBQueryParsingResult( targetType, entityPersister.getTableName(), query, getProjectionDocument(), orderBy, unwinds, getOperation() ); }
Source:
<code>public void updateStatData() { URI curStatPathURI = null; URI oldStatPathURI = null; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(PerfPlugin.PERF_COMMAND); stringBuilder.append("%s."); stringBuilder.append(PerfSaveStatsHandler.DATA_EXT); String statNameFormat = stringBuilder.toString(); IPath workingDir = getWorkDir(); String curStatName = String.format(statNameFormat, ""); IPath curStatPath = workingDir.append(curStatName); IRemoteFileProxy proxy = null; try { curStatPathURI = new URI(curStatPath.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(curStatPathURI); IFileStore curFileStore = proxy.getResource(curStatPathURI.getPath()); if (curFileStore.fetchInfo().exists()) { String oldStatName = String.format(statNameFormat, ".old"); IPath oldStatPath = workingDir.append(oldStatName); oldStatPathURI = new URI(oldStatPath.toPortableString()); IFileStore oldFileStore = proxy.getResource(oldStatPathURI.getPath()); if (oldFileStore.fetchInfo().exists()) { oldFileStore.delete(EFS.NONE, null); } curFileStore.copy(oldFileStore, EFS.NONE, null); } PerfSaveStatsHandler saveStats = new PerfSaveStatsHandler(); saveStats.saveData(PerfPlugin.PERF_COMMAND); } catch (URISyntaxException e) { <START> e.printStackTrace(); <END> } catch (CoreException e) { e.printStackTrace(); } }</code><technical_language>Do printStackTrace. Handle in a user get some information instead of dig in .log file</technical_language>

Target:
public void updateStatData() { URI curStatPathURI = null; URI oldStatPathURI = null; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(PerfPlugin.PERF_COMMAND); stringBuilder.append("%s."); stringBuilder.append(PerfSaveStatsHandler.DATA_EXT); String statNameFormat = stringBuilder.toString(); IPath workingDir = getWorkDir(); String curStatName = String.format(statNameFormat, ""); IPath curStatPath = workingDir.append(curStatName); IRemoteFileProxy proxy = null; try { curStatPathURI = new URI(curStatPath.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(curStatPathURI); IFileStore curFileStore = proxy.getResource(curStatPathURI.getPath()); if (curFileStore.fetchInfo().exists()) { String oldStatName = String.format(statNameFormat, ".old"); IPath oldStatPath = workingDir.append(oldStatName); oldStatPathURI = new URI(oldStatPath.toPortableString()); IFileStore oldFileStore = proxy.getResource(oldStatPathURI.getPath()); if (oldFileStore.fetchInfo().exists()) { oldFileStore.delete(EFS.NONE, null); } curFileStore.copy(oldFileStore, EFS.NONE, null); } PerfSaveStatsHandler saveStats = new PerfSaveStatsHandler(); saveStats.saveData(PerfPlugin.PERF_COMMAND); } catch (URISyntaxException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } catch (CoreException e) { MessageDialog.openError(Display.getCurrent().getActiveShell(), Messages.MsgProxyError, Messages.MsgProxyError); } }
Source:
<code>private DockerClient.BuildParam[] buildParams() throws UnsupportedEncodingException, JsonProcessingException { final List<DockerClient.BuildParam> buildParams = Lists.newArrayList(); if (pullOnBuild) { buildParams.add(DockerClient.BuildParam.pullNewerImage()); } if (noCache) { buildParams.add(DockerClient.BuildParam.noCache()); } if (!buildArgs.isEmpty()) { buildParams.add(DockerClient.BuildParam.create("buildargs", <START> URLEncoder.encode(new ObjectMapper().writeValueAsString(buildArgs), "UTF-8"))); <END> } return buildParams.toArray(new DockerClient.BuildParam[buildParams.size()]); }</code><technical_language>store ObjectMapper a field of class, avoid re-instantiation</technical_language>

Target:
private DockerClient.BuildParam[] buildParams() throws UnsupportedEncodingException, JsonProcessingException { final List<DockerClient.BuildParam> buildParams = Lists.newArrayList(); if (pullOnBuild) { buildParams.add(DockerClient.BuildParam.pullNewerImage()); } if (noCache) { buildParams.add(DockerClient.BuildParam.noCache()); } if (!buildArgs.isEmpty()) { buildParams.add(DockerClient.BuildParam.create("buildargs", URLEncoder.encode(OBJECT_MAPPER.writeValueAsString(buildArgs), "UTF-8"))); } return buildParams.toArray(new DockerClient.BuildParam[buildParams.size()]); }
Source:
<code>private void createMapVariant(final MethodNode mNode, final AnnotationNode anno, final Parameter mapParam, final List<Parameter> genParams, final ClassNode cNode, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames) { Parameter namedArgKey = param(STRING_TYPE, "namedArgKey"); inner.addStatement( new ForStatement( namedArgKey, callX(varX(mapParam), "keySet"), new AssertStatement(boolX(callX(list2args(propNames), "contains", varX(namedArgKey))), plusX(constX("Unrecognized namedArgKey: "), varX(namedArgKey))) )); Parameter[] genParamsArray = genParams.toArray(Parameter.EMPTY_ARRAY); if (cNode.hasMethod(mNode.getName(), genParamsArray)) { addError("Error during " + NAMED_VARIANT + " processing. Class " + cNode.getNameWithoutPackage() + " already has a named-arg " + (mNode instanceof ConstructorNode ? "constructor" : "method") + " of type " + genParams, mNode); return; } BlockStatement body = new BlockStatement(); int modifiers = getVisibility(anno, mNode, mNode.getClass(), mNode.getModifiers()); if (mNode instanceof ConstructorNode) { body.addStatement(stmt(ctorX(ClassNode.THIS, args))); body.addStatement(inner); <START> skipTypeChecked(addGeneratedConstructor(cNode, <END> modifiers, genParamsArray, mNode.getExceptions(), body )); } else { body.addStatement(inner); body.addStatement(stmt(callThisX(mNode.getName(), args))); skipTypeChecked(addGeneratedMethod(cNode, mNode.getName(), modifiers, mNode.getReturnType(), genParamsArray, mNode.getExceptions(), body )); } }</code><technical_language>skipTypeChecked here</technical_language>

Target:
private void createMapVariant(final MethodNode mNode, final AnnotationNode anno, final Parameter mapParam, final List<Parameter> genParams, final ClassNode cNode, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames) { Parameter namedArgKey = param(STRING_TYPE, "namedArgKey"); inner.addStatement( new ForStatement( namedArgKey, callX(varX(mapParam), "keySet"), new AssertStatement(boolX(callX(list2args(propNames), "contains", varX(namedArgKey))), plusX(constX("Unrecognized namedArgKey: "), varX(namedArgKey))) )); Parameter[] genParamsArray = genParams.toArray(Parameter.EMPTY_ARRAY); if (cNode.hasMethod(mNode.getName(), genParamsArray)) { addError("Error during " + NAMED_VARIANT + " processing. Class " + cNode.getNameWithoutPackage() + " already has a named-arg " + (mNode instanceof ConstructorNode ? "constructor" : "method") + " of type " + genParams, mNode); return; } BlockStatement body = new BlockStatement(); int modifiers = getVisibility(anno, mNode, mNode.getClass(), mNode.getModifiers()); if (mNode instanceof ConstructorNode) { body.addStatement(stmt(ctorX(ClassNode.THIS, args))); body.addStatement(inner); addGeneratedConstructor(cNode, modifiers, genParamsArray, mNode.getExceptions(), body ); } else { body.addStatement(inner); body.addStatement(stmt(callThisX(mNode.getName(), args))); addGeneratedMethod(cNode, mNode.getName(), modifiers, mNode.getReturnType(), genParamsArray, mNode.getExceptions(), body ); } }
Source:
<code>private Window(Node n, int capacity) { current = start = first = n; markCapacity = capacity; <START> marked = new ArrayList<Node>(capacity); <END> }</code><technical_language>capacity + 1</technical_language>

Target:
private Window(Node n, int capacity) { current = start = first = n; markCapacity = capacity; marked = new ArrayList<Node>(capacity + 1); }
Source:
<code>private boolean waitForReady(final MessageContext msgContext) { synchronized (msgContext) { while (!Boolean.TRUE.equals(msgContext.getProperty(PassThroughConstants.WAIT_BUILDER_IN_STREAM_COMPLETE)) && !Boolean.TRUE.equals(msgContext.getProperty("PASSTHRU_CONNECT_ERROR"))) { try { msgContext.wait(); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } } } if (Boolean.TRUE.equals(msgContext.getProperty("PASSTHRU_CONNECT_ERROR"))) { return false; } return true; }</code><technical_language>please avoid printStackTrace(). log error stack trace a message log.error()</technical_language>

Target:
private boolean waitForReady(final MessageContext msgContext) { synchronized (msgContext) { while (!Boolean.TRUE.equals(msgContext.getProperty(PassThroughConstants.WAIT_BUILDER_IN_STREAM_COMPLETE)) && !Boolean.TRUE.equals(msgContext.getProperty("PASSTHRU_CONNECT_ERROR"))) { try { msgContext.wait(); } catch (InterruptedException e) { log.error("Interrupted while waiting for passthru connection..", e); } } } if (Boolean.TRUE.equals(msgContext.getProperty("PASSTHRU_CONNECT_ERROR"))) { return false; } return true; }
Source:
<code>private void validateJobExecutions() { RepeatTemplate template = new RepeatTemplate(); <START> Date startDate = new Date(); <END> template.iterate(new RepeatCallback() { public RepeatStatus doInIteration(RepeatContext context) throws InterruptedException { List<JobExecution> failedJobExecutions = new ArrayList<>(); RepeatStatus repeatStatus = RepeatStatus.FINISHED; for (JobExecution jobExecution : jobExecutionList) { JobExecution currentJobExecution = taskJobExplorer.getJobExecution(jobExecution.getId()); String exitStatus = currentJobExecution.getExitStatus().getExitCode(); if (!exitStatus.equals(ExitStatus.FAILED.getExitCode()) && !exitStatus.equals(ExitStatus.COMPLETED.getExitCode()) && !exitStatus.equals(ExitStatus.STOPPED.getExitCode())) { repeatStatus = RepeatStatus.CONTINUABLE; } if (exitStatus.equals(ExitStatus.FAILED.getExitCode())) { failedJobExecutions.add(jobExecution); } } Thread.sleep(failOnJobFailurePollIntervalInMillis); if (repeatStatus.equals(RepeatStatus.FINISHED) && failedJobExecutions.size() > 0) { throwJobFailedException(failedJobExecutions); } if (repeatStatus.isContinuable() && failOnJobFailurewaitTimeInMillis != 0 && (new Date()).getTime() - startDate.getTime() > failOnJobFailurewaitTimeInMillis) { throw new IllegalStateException("Not all jobs were completed " + "within the time specified by spring.cloud.task.batch." + "failOnJobFailurewaitTimeInMillis."); } return repeatStatus; } }); }</code><technical_language>Again...wrong status</technical_language>

Target:
private void validateJobExecutions() { RepeatTemplate template = new RepeatTemplate(); Date startDate = new Date(); template.iterate(new RepeatCallback() { public RepeatStatus doInIteration(RepeatContext context) throws InterruptedException { List<JobExecution> failedJobExecutions = new ArrayList<>(); RepeatStatus repeatStatus = RepeatStatus.FINISHED; for (JobExecution jobExecution : jobExecutionList) { JobExecution currentJobExecution = taskJobExplorer.getJobExecution(jobExecution.getId()); BatchStatus batchStatus = currentJobExecution.getStatus(); if (batchStatus.isRunning()) { repeatStatus = RepeatStatus.CONTINUABLE; } if (batchStatus.equals(BatchStatus.FAILED)) { failedJobExecutions.add(jobExecution); } } Thread.sleep(taskBatchProperties.getFailOnJobFailurePollInterval()); if (repeatStatus.equals(RepeatStatus.FINISHED) && failedJobExecutions.size() > 0) { throwJobFailedException(failedJobExecutions); } if (repeatStatus.isContinuable() && taskBatchProperties.getFailOnJobFailurewaitTime() != 0 && (new Date()).getTime() - startDate.getTime() > taskBatchProperties.getFailOnJobFailurewaitTime()) { throw new IllegalStateException("Not all jobs were completed " + "within the time specified by spring.cloud.task.batch." + "failOnJobFailurewaitTime."); } return repeatStatus; } }); }
Source:
<code>public Channel retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); <START> if (this.channel == null) { <END> this.channel = new Channel(); } BCgetWLANConfig.Response response = bridge.bridgeCommunicate(new BCgetWLANConfig()); if (response != null) { logger.trace("retrieve() found successfully configuration {}.", response.getWLANConfig()); this.channel.wlanSSID = response.getWLANConfig().getSSID(); this.channel.wlanPassword = response.getWLANConfig().getPassword(); this.channel.isRetrieved = true; return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }</code><technical_language>consider dropping of meaningless references this. code</technical_language>

Target:
public Channel retrieve(VeluxBridgeProvider bridge) { logger.trace("retrieve() called."); if (channel == null) { channel = new Channel(); } BCgetWLANConfig.Response response = bridge.bridgeCommunicate(new BCgetWLANConfig()); if (response != null) { logger.trace("retrieve() found successfully configuration {}.", response.getWLANConfig()); channel.wlanSSID = response.getWLANConfig().getSSID(); channel.wlanPassword = response.getWLANConfig().getPassword(); channel.isRetrieved = true; return channel; } else { logger.trace("retrieve() finished with failure."); return null; } }
Source:
<code>public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { <START> throw new SBusinessDataRepositoryException("no client-bdnm.zip found in tenant resources"); <END> } return sTenantResource.getContent(); }</code><technical_language>typo</technical_language>

Target:
public byte[] getClientBDMZip() throws SBusinessDataRepositoryException { STenantResource sTenantResource; try { sTenantResource = tenantResourcesService.get(TenantResourceType.BDM, CLIENT_BDM_ZIP); } catch (SBonitaReadException e) { throw new SBusinessDataRepositoryException(e); } if (sTenantResource == null) { throw new SBusinessDataRepositoryException("no client-bdm.zip found in tenant resources"); } return sTenantResource.getContent(); }
Source:
<code>private String getOpenSearchURL(String title){ <START> String query = "&q=srw.ti+all+\"" + title.replaceAll(" ", "%20") + "\""; <END> return WORLDCAT_OPEN_SEARCH_URL + query.replace("\"", "%22"); }</code><technical_language>Instead of manually replaying illegal chars, I create a URL (java.net.URL) java system handle encoding of forbidden chars</technical_language>

Target:
private String getOpenSearchURL(String title) throws MalformedURLException { String query = "&q=srw.ti+all+\"" + title + "\""; URL url = new URL(WORLDCAT_OPEN_SEARCH_URL + query); return url.toString(); }
Source:
<code>private List<Observation> convertObservationMapToList(Map<String, String> observations, DateTime obsDatetime) { List<Observation> observationList = new ArrayList<>(); for (String observationConceptName : observations.keySet()) { <START> if (valueIsNotEmpty(observations, observationConceptName)) { <END> Observation observation = new Observation(); ConceptName conceptName = new ConceptName(observationConceptName); Concept concept = new Concept(conceptName); observation.setConcept(concept); String observationMapValue = observations.get(observationConceptName); Observation.ObservationValue observationValue = new Observation.ObservationValue(observationMapValue); observation.setValue(observationValue); observation.setObsDatetime(obsDatetime.toDate()); observationList.add(observation); } } return observationList; }</code><technical_language>additionally, please log info if is empty, omit creating this observation of empty value. I WARN level ok</technical_language>

Target:
private List<Observation> convertObservationMapToList(Map<String, String> observations, DateTime obsDatetime) { List<Observation> observationList = new ArrayList<>(); for (String observationConceptName : observations.keySet()) { if (valueIsNotEmpty(observations, observationConceptName)) { Observation observation = new Observation(); ConceptName conceptName = new ConceptName(observationConceptName); Concept concept = new Concept(conceptName); observation.setConcept(concept); String observationMapValue = observations.get(observationConceptName); Observation.ObservationValue observationValue = new Observation.ObservationValue(observationMapValue); observation.setValue(observationValue); observation.setObsDatetime(obsDatetime.toDate()); observationList.add(observation); } else { LOGGER.warn("Observation value is null or empty for concept: " + observationConceptName + " and will not be created"); } } return observationList; }
Source:
<code>public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { <START> return Maps.filterKeys(nodes, in(Sets.newHashSet(ids))).values(); <END> }</code><technical_language>Couple more static imports here</technical_language>

Target:
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) { return filterKeys(nodes, in(ImmutableSet.copyOf(ids))).values(); }
Source:
<code>private boolean hasDeprecationAnnotationConstructor(Class[] classes) { <START> Annotation[] annotations = new Annotation[0]; <END> try { annotations = URLBuilder.class.getConstructor(classes).getAnnotations(); } catch (NoSuchMethodException e) { e.printStackTrace(); } for (Annotation annotation : annotations) { if(annotation.annotationType().equals(Deprecated.class)) { return true; } } return false; }</code><technical_language>drop = new Annotation[0], needed if needed, declaring a zero-length array is silly</technical_language>

Target:
private boolean hasDeprecationAnnotationConstructor(Class[] classes) { try { return URLBuilder.class.getConstructor(classes).isAnnotationPresent(Deprecated.class); } catch (NoSuchMethodException e) { e.printStackTrace(); } return false; }
Source:
<code>public void onApplicationEvent(ListenerContainerIdleEvent event) { LogFactory.getLog(this.getClass()).info(event); <START> if ("foo".equals(event.getListenerId())) { <END> this.event = event; this.latch.countDown(); } }</code><technical_language>M-m-m. for in this application context other listeners. I missing</technical_language>

Target:
public void onApplicationEvent(ListenerContainerIdleEvent event) { if (!"foo".equals(event.getListenerId())) { this.barEventReceived = true; } logger.info("foo: " + event); this.event = event; this.latch.countDown(); }
Source:
<code>private void activateDataCenter() { StorageDomain masterDomain = <START> getStorageDomainDao().getStorageDomains(getStoragePool().getId(), StorageDomainType.Master).get(0); <END> calcStoragePoolStatusByDomainsStatus(); if (masterDomain != null && masterDomain.getStatus() != null && (masterDomain.getStatus() == StorageDomainStatus.Active || masterDomain.getStatus() == StorageDomainStatus.Unknown || masterDomain.getStatus() == StorageDomainStatus.Inactive)) { resetIrs(); } }</code><technical_language>a risk of IndexOutOfBoundsException if a master domain is found? code handling gracefully a situation master is null a situation this</technical_language>

Target:
private void activateDataCenter() { StorageDomain masterDomain = getStorageDomainDao().getStorageDomains(getStoragePool().getId(), StorageDomainType.Master).stream().findFirst().orElse(null); calcStoragePoolStatusByDomainsStatus(); if (masterDomain != null && masterDomain.getStatus() != null && (masterDomain.getStatus() == StorageDomainStatus.Active || masterDomain.getStatus() == StorageDomainStatus.Unknown || masterDomain.getStatus() == StorageDomainStatus.Inactive)) { resetIrs(); } }
Source:
<code>private void changeLanguage(String languageCode) { if (mLanguagePreference == null || TextUtils.isEmpty(languageCode)) { return; } if (!LocaleManager.isDifferentLanguage(languageCode)) { return; } Context newContext = LocaleManager.setNewLocale(WordPress.getContext(), languageCode); updateLanguagePreference(languageCode); Map<String, Object> properties = new HashMap<>(); properties.put("app_locale", newContext.getResources().getConfiguration().locale.toString()); AnalyticsTracker.track(Stat.ACCOUNT_SETTINGS_LANGUAGE_CHANGED, properties); AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); <START> <END> Intent refresh = new Intent(getActivity(), getActivity().getClass()); startActivity(refresh); getActivity().setResult(LANGUAGE_CHANGED); getActivity().finish(); }</code><technical_language>I need this mSettings property anymore changes. remove well</technical_language>

Target:
private void changeLanguage(String languageCode) { if (mLanguagePreference == null || TextUtils.isEmpty(languageCode)) { return; } if (LocaleManager.isSameLanguage(languageCode)) { return; } LocaleManager.setNewLocale(WordPress.getContext(), languageCode); updateLanguagePreference(languageCode); Map<String, Object> properties = new HashMap<>(); properties.put("app_locale", Locale.getDefault()); AnalyticsTracker.track(Stat.ACCOUNT_SETTINGS_LANGUAGE_CHANGED, properties); AnalyticsUtils.refreshMetadata(mAccountStore, mSiteStore); Intent refresh = new Intent(getActivity(), getActivity().getClass()); startActivity(refresh); getActivity().setResult(LANGUAGE_CHANGED); getActivity().finish(); }
Source:
<code>public String toString() { return <START> os.toString(); <END> }</code><technical_language>if more informative / useful debug add "ForwardingOs{os=" + os.toString() + "}" delegating straight through</technical_language>

Target:
public String toString() { return "ForwardingOs{os=" + os + "}"; }
Source:
<code>private void checkBatteryOptimizations() { <START> if (Application.isIgnoringBatteryOptimizations(getApplicationContext())) { <END> showIgnoreBatteryOptimizationDialog(); } }</code><technical_language>this be: if (!Application.isIgnoringBatteryOptimizations(getApplicationContext())) { want app ignoring battery optimizations</technical_language>

Target:
private void checkBatteryOptimizations() { if (PreferenceUtils.getBoolean(getString(R.string.not_request_battery_optimizations_key), false) || !TravelBehaviorUtils.isUserParticipatingInStudy()) { return; } Boolean ignoringBatteryOptimizations = Application.isIgnoringBatteryOptimizations(getApplicationContext()); if (ignoringBatteryOptimizations != null && !ignoringBatteryOptimizations) { showIgnoreBatteryOptimizationDialog(); } }
Source:
<code><START> public static String getParseErrorMessage(ParseErrorMessage parseErrorMessage) { <END> final LocalizedMessage lmessage = new LocalizedMessage( parseErrorMessage.getLineNumber(), "com.puppycrawl.tools.checkstyle.checks.javadoc.messages", parseErrorMessage.getMessageKey(), parseErrorMessage.getMessageArguments(), "", DetailNodeTreeStringPrinter.class, null); return "[ERROR:" + parseErrorMessage.getLineNumber() + "] " + lmessage.getMessage(); }</code><technical_language>I tests referrencing this method. loosen modifiers for easier testing. reflection grab method</technical_language>

Target:
private static String getParseErrorMessage(ParseErrorMessage parseErrorMessage) { final LocalizedMessage lmessage = new LocalizedMessage( parseErrorMessage.getLineNumber(), "com.puppycrawl.tools.checkstyle.checks.javadoc.messages", parseErrorMessage.getMessageKey(), parseErrorMessage.getMessageArguments(), "", DetailNodeTreeStringPrinter.class, null); return "[ERROR:" + parseErrorMessage.getLineNumber() + "] " + lmessage.getMessage(); }
Source:
<code>void addObservations(List<Obs> observations) { for (Obs obs : observations) { if (obs == null) continue; <START> Column column = getColumnContainingTime(point.time); <END> if (obs.conceptUuid.equals(AppModel.ORDER_EXECUTED_CONCEPT_UUID)) { Integer count = column.executionCountsByOrderUuid.get(obs.value); column.executionCountsByOrderUuid.put( obs.value, count == null ? 1 : count + 1); } else { addObs(column, obs); } } }</code><technical_language>@zestyping This merge is conflicting right here. if I remove this lines point is declared. please resolve this conflict</technical_language>

Target:
void addObservations(List<Obs> observations) { for (Obs obs : observations) { if (obs == null) continue; Column column = getColumnContainingTime(obs.time); if (obs.conceptUuid.equals(AppModel.ORDER_EXECUTED_CONCEPT_UUID)) { Integer count = column.executionCountsByOrderUuid.get(obs.value); column.executionCountsByOrderUuid.put( obs.value, count == null ? 1 : count + 1); } else { addObs(column, obs); } } }
Source:
<code>public List<String> firstTen(final String... args) { final List<String> list = new ArrayList<String>(args.length); list.addAll(Arrays.asList(args)); <START> final List<String> result = new LinkedList<>(); <END> result.addAll(list.subList(0, InvalidDiamondsUsage.TEN)); return result; }</code><technical_language>@vkuchyn get, 2 lines here? I thought added cover "happy path", no? If yes, removed</technical_language>

Target:
public List<String> firstTen(final String... args) { final List<String> list = new ArrayList<String>(args.length); list.addAll(Arrays.asList(args)); return list; }
Source:
<code>private FeedbackQuestionFeedbackPathSettings configureFeedbackPathSettings( FeedbackQuestionAttributes question) { FeedbackQuestionFeedbackPathSettings settings = new FeedbackQuestionFeedbackPathSettings(); settings.setSelectedGiver(question.giverType); settings.setSelectedRecipient(question.recipientType); boolean isNumberOfEntitiesToGiveFeedbackToChecked = question.numberOfEntitiesToGiveFeedbackTo != Const.MAX_POSSIBLE_RECIPIENTS; settings.setNumberOfEntitiesToGiveFeedbackToChecked(isNumberOfEntitiesToGiveFeedbackToChecked); settings.setNumOfEntitiesToGiveFeedbackToValue(isNumberOfEntitiesToGiveFeedbackToChecked ? question.numberOfEntitiesToGiveFeedbackTo <START> : 1); <END> boolean isCommonGiver = Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.containsKey(question.giverType); boolean isCommonPath = isCommonGiver && Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.get(question.giverType) .contains(question.recipientType); settings.setIsCommonPathSelected(isCommonPath); return settings; }</code><technical_language>This is before, i.e add another level of indentation for ? :</technical_language>

Target:
private FeedbackQuestionFeedbackPathSettings configureFeedbackPathSettings( FeedbackQuestionAttributes question) { FeedbackQuestionFeedbackPathSettings settings = new FeedbackQuestionFeedbackPathSettings(); settings.setSelectedGiver(question.giverType); settings.setSelectedRecipient(question.recipientType); boolean isNumberOfEntitiesToGiveFeedbackToChecked = question.numberOfEntitiesToGiveFeedbackTo != Const.MAX_POSSIBLE_RECIPIENTS; settings.setNumberOfEntitiesToGiveFeedbackToChecked(isNumberOfEntitiesToGiveFeedbackToChecked); settings.setNumOfEntitiesToGiveFeedbackToValue(isNumberOfEntitiesToGiveFeedbackToChecked ? question.numberOfEntitiesToGiveFeedbackTo : 1); boolean isCommonGiver = Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.containsKey(question.giverType); boolean isCommonPath = isCommonGiver && Const.FeedbackQuestion.COMMON_FEEDBACK_PATHS.get(question.giverType) .contains(question.recipientType); settings.setCommonPathSelected(isCommonPath); return settings; }
Source:
<code>public Stream<QueryTerminationResult> killQueries( @Name( "ids" ) List<String> idTexts ) throws InvalidArgumentsException, IOException { securityContext.assertCredentialsNotExpired(); try { Set<Long> queryIds = idTexts.stream().map( catchThrown( InvalidArgumentsException.class, QueryId::fromExternalString ) ).map( catchThrown( InvalidArgumentsException.class, QueryId::kernelQueryId ) ).collect( toSet() ); Set<QueryTerminationResult> terminatedQuerys = getActiveTransactions( tx -> executingQueriesWithIds( queryIds, tx ) ).map( catchThrown( InvalidArgumentsException.class, this::killQueryTransaction ) ).collect( toSet() ); <START> Config configs = resolver.resolveDependency( Config.class ); <END> if ( configs.get( GraphDatabaseSettings.kill_query_verbose ) && terminatedQuerys.size() != idTexts.size() ) { for ( String id : idTexts ) { if ( !terminatedQuerys.stream().anyMatch( query -> query.queryId.equals( id ) ) ) { terminatedQuerys.add( new QueryFailedTerminationResult( fromExternalString( id ) ) ); } } } return terminatedQuerys.stream(); } catch ( UncaughtCheckedException uncaught ) { throwIfPresent( uncaught.getCauseIfOfType( InvalidArgumentsException.class ) ); throw uncaught; } }</code><technical_language>here, this needs done</technical_language>

Target:
public Stream<QueryTerminationResult> killQueries( @Name( "ids" ) List<String> idTexts ) throws InvalidArgumentsException, IOException { securityContext.assertCredentialsNotExpired(); try { Set<Long> queryIds = idTexts.stream().map( catchThrown( InvalidArgumentsException.class, QueryId::fromExternalString ) ).map( catchThrown( InvalidArgumentsException.class, QueryId::kernelQueryId ) ).collect( toSet() ); Set<QueryTerminationResult> terminatedQuerys = getActiveTransactions( tx -> executingQueriesWithIds( queryIds, tx ) ).map( catchThrown( InvalidArgumentsException.class, this::killQueryTransaction ) ).collect( toSet() ); boolean killQueryVerbose = resolver.resolveDependency( Config.class ).get( GraphDatabaseSettings.kill_query_verbose ); if ( killQueryVerbose && terminatedQuerys.size() != idTexts.size() ) { for ( String id : idTexts ) { if ( !terminatedQuerys.stream().anyMatch( query -> query.queryId.equals( id ) ) ) { terminatedQuerys.add( new QueryFailedTerminationResult( fromExternalString( id ) ) ); } } } return terminatedQuerys.stream(); } catch ( UncaughtCheckedException uncaught ) { throwIfPresent( uncaught.getCauseIfOfType( InvalidArgumentsException.class ) ); throw uncaught; } }
Source:
<code>private static RecordWriter createRcFileWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException { int columns = properties.getProperty(META_TABLE_COLUMNS).split(",").length; RCFileOutputFormat.setColumnNumber(conf, columns); CompressionCodec codec = null; if (compress) { codec = ReflectionUtil.newInstance(getOutputCompressorClass(conf, DefaultCodec.class), conf); } RCFile.Writer writer = new RCFile.Writer(target.getFileSystem(conf), conf, target, () -> {}, codec); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { writer.append(value); length = writer.getLength(); } @Override public void close(boolean abort) throws IOException { <START> length = writer.getLength(); <END> writer.close(); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }</code><technical_language>wrap try/ignore</technical_language>

Target:
private static RecordWriter createRcFileWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException { int columns = properties.getProperty(META_TABLE_COLUMNS).split(",").length; RCFileOutputFormat.setColumnNumber(conf, columns); CompressionCodec codec = null; if (compress) { codec = ReflectionUtil.newInstance(getOutputCompressorClass(conf, DefaultCodec.class), conf); } RCFile.Writer writer = new RCFile.Writer(target.getFileSystem(conf), conf, target, () -> {}, codec); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { writer.append(value); length = writer.getLength(); } @Override public void close(boolean abort) throws IOException { writer.close(); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }