auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testRunHook() throws Exception { assumeSupportedPlatform(); writeHookFile(PreCommitHook.NAME, <START> "#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\necho $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\""); <END> ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); ProcessResult res = FS.DETECTED.runHookIfPresent(db, PreCommitHook.NAME, new String[] { "arg1", "arg2" }, new PrintStream(out), new PrintStream(err), "stdin"); assertEquals("unexpected hook output", "test arg1 arg2\nstdin\n" + db.getDirectory().getAbsolutePath() + '\n' + db.getWorkTree().getAbsolutePath() + '\n', out.toString("UTF-8")); assertEquals("unexpected output on stderr stream", "stderr\n", err.toString("UTF-8")); assertEquals("unexpected exit code", 0, res.getExitCode()); assertEquals("unexpected process status", ProcessResult.Status.OK, res.getStatus()); }</code><technical_language>Wrap this line</technical_language>

Target:
public void testRunHook() throws Exception { assumeSupportedPlatform(); writeHookFile(PreCommitHook.NAME, "#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\n" + "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\""); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); ProcessResult res = FS.DETECTED.runHookIfPresent(db, PreCommitHook.NAME, new String[] { "arg1", "arg2" }, new PrintStream(out), new PrintStream(err), "stdin"); assertEquals("unexpected hook output", "test arg1 arg2\nstdin\n" + db.getDirectory().getAbsolutePath() + '\n' + db.getWorkTree().getAbsolutePath() + '\n', out.toString("UTF-8")); assertEquals("unexpected output on stderr stream", "stderr\n", err.toString("UTF-8")); assertEquals("unexpected exit code", 0, res.getExitCode()); assertEquals("unexpected process status", ProcessResult.Status.OK, res.getStatus()); }
Source:
<code>public static double[] reorderedCopy(double[] values, int[] positions) { int len1 = positions.length; if (len1 != values.length) { throw new IllegalArgumentException("Value array cannot be reordered as they differ in length"); } double[] result = new double[len1]; for (int i = 0; i < len1; i++) { int key = positions[i]; <START> ArgChecker.inRange(key, 0, len1, "key must be in range: 0 <= key < length"); <END> result[i] = values[key]; } return result; }</code><technical_language>suggestion ArgChecker.inRange(key, 0, len1, "key");</technical_language>

Target:
public static double[] reorderedCopy(double[] values, int[] positions) { int len1 = positions.length; if (len1 != values.length) { throw new IllegalArgumentException("Value array cannot be reordered as they differ in length"); } double[] result = new double[len1]; for (int i = 0; i < len1; i++) { int key = positions[i]; ArgChecker.inRange(key, 0, len1, "key"); result[i] = values[key]; } return result; }
Source:
<code>public static final boolean isTreeTable(final TableConfiguration tableConfiguration) { <START> TableDisplayStyle style = (TableDisplayStyle) tableConfiguration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); <END> if (style != null) { final DisplayStyle displayStyle = style.getDisplayStyle(); return DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(displayStyle) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle); } return false; }</code><technical_language>final</technical_language>

Target:
public static final boolean isTreeTable(final TableConfiguration tableConfiguration) { final TableDisplayStyle style = (TableDisplayStyle) tableConfiguration.getStyle(NattablestylePackage.eINSTANCE.getTableDisplayStyle()); if (null != style) { final DisplayStyle displayStyle = style.getDisplayStyle(); return DisplayStyle.HIERARCHIC_MULTI_TREE_COLUMN.equals(displayStyle) || DisplayStyle.HIERARCHIC_SINGLE_TREE_COLUMN.equals(displayStyle); } return false; }
Source:
<code>protected long getCommitSize() { ConfigurationService configurationService = Framework.getService(ConfigurationService.class); <START> String commitSize = configurationService.getProperty(DEFAULT_COMMIT_SIZE_PROP); <END> if (commitSize == null) { return DEFAULT_COMMIT_SIZE; } try { return Long.parseLong(commitSize); } catch (NumberFormatException e) { log.error("Invalid configuration property " + DEFAULT_COMMIT_SIZE_PROP, e); return DEFAULT_COMMIT_SIZE; } }</code><technical_language>Update StringUtils.isBlank actually</technical_language>

Target:
protected long getCommitSize() { ConfigurationService configurationService = Framework.getService(ConfigurationService.class); String commitSize = configurationService.getProperty(DEFAULT_COMMIT_SIZE_PROP); if (StringUtils.isBlank(commitSize)) { return DEFAULT_COMMIT_SIZE; } try { return Long.parseLong(commitSize); } catch (NumberFormatException e) { log.error("Invalid configuration property " + DEFAULT_COMMIT_SIZE_PROP, e); return DEFAULT_COMMIT_SIZE; } }
Source:
<code>public MultiMapContainer(String name, MultiMapService service, int partitionId) { super(name, service.getNodeEngine()); this.partitionId = partitionId; this.lockNamespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name); LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME); this.lockStore = lockService == null ? null : lockService.createLockStore(partitionId, lockNamespace); this.creationTime = currentTimeMillis(); this.objectNamespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name); <START> this.size = new AtomicInteger(0); <END> }</code><technical_language>I pull this initialization out of constructor constructor simple provide initialization variable is declared is easier digest</technical_language>

Target:
public MultiMapContainer(String name, MultiMapService service, int partitionId) { super(name, service.getNodeEngine()); this.partitionId = partitionId; this.lockNamespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name); LockService lockService = nodeEngine.getSharedService(LockService.SERVICE_NAME); this.lockStore = lockService == null ? null : lockService.createLockStore(partitionId, lockNamespace); this.creationTime = currentTimeMillis(); this.objectNamespace = new DistributedObjectNamespace(MultiMapService.SERVICE_NAME, name); }
Source:
<code>protected static void updateLocalDisksUsage(VDS vds, Map<String, Object> xmlRpcStruct) { if (xmlRpcStruct.containsKey(VdsProperties.DISK_STATS)) { Map<String, Object> diskStatsStruct = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.DISK_STATS); Map<String, Long> diskStats = new HashMap<>(); vds.setLocalDisksUsage(diskStats); <START> diskStatsStruct.entrySet() .stream() .forEach(entry -> diskStats.put(entry.getKey(), assignLongValue((Map<String, Object>) entry.getValue(), VdsProperties.DISK_STATS_FREE))); <END> } }</code><technical_language>I Java 8 is below: Map<String, Long> diskStats = diskStatsStruct .entrySet() .stream() .collect(Collectors.toMap(Entry::getKey, e -> assignLongValue((Map<String, Object>)e.getValue(), VdsProperties.DISK_STATS_FREE)));</technical_language>

Target:
protected static void updateLocalDisksUsage(VDS vds, Map<String, Object> xmlRpcStruct) { if (xmlRpcStruct.containsKey(VdsProperties.DISK_STATS)) { Map<String, Object> diskStatsStruct = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.DISK_STATS); Map<String, Long> diskStats = diskStatsStruct.entrySet() .stream() .collect(Collectors.toMap(Entry::getKey, e -> assignLongValue((Map<String, Object>) e.getValue(), VdsProperties.DISK_STATS_FREE))); vds.setLocalDisksUsage(diskStats); } }
Source:
<code>public void checkConstruction() { <START> ConfigureISODatesInJson testInstance = new ConfigureISODatesInJson(); <END> Assert.assertEquals("ConfigureISODatesInJson", testInstance.getName()); Assert.assertTrue(testInstance.getEvents().get(0).getClass() == ApplicationStartedEvent.class); }</code><technical_language>instantiate yourself, mocker.getComponentUnderTest(), invoke constructor for you</technical_language>

Target:
public void checkConstruction() throws ComponentLookupException { EventListener testInstance = this.mocker.getComponentUnderTest(); Assert.assertEquals("ConfigureISODatesInJson", testInstance.getName()); Assert.assertThat(testInstance.getEvents(), hasItem(isA(ApplicationStartedEvent.class))); }
Source:
<code>public Response migrate(Action action) { <START> validateParameters(action, "bricks"); <END> GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StartRemoveGlusterVolumeBricks, params, action, false); }</code><technical_language>validating ^ id name is provided</technical_language>

Target:
public Response migrate(Action action) { validateParameters(action, "bricks"); validateBrickNames(action); GlusterVolumeRemoveBricksParameters params = toParameters(action); return performAction(VdcActionType.StartRemoveGlusterVolumeBricks, params, action, false); }
Source:
<code>private Boolean checkProblemValue() { final SWTBotView problemViewBot = bot.viewByTitle("Problems"); problemViewBot.setFocus(); final SWTBotTree problemTree = problemViewBot.bot().tree(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return (problemViewBot.isActive()) && (problemTree.getAllItems().length == 1); } public void init(SWTBot bot) { } public String getFailureMessage() { return "Problems view is not active."; } }); <START> String errorMessage = "\"Group > emptyName > diagTest > Default > \" is not a valid name, it must be different of empty or null."; <END> for (SWTBotTreeItem item : problemTree.getAllItems()) { item.expand(); for (String itemMessage : item.getNodes()) { if (errorMessage.equals(itemMessage)) { return true; } } } return false; }</code><technical_language>nice if declare this variable static in top of this class</technical_language>

Target:
private Boolean checkProblemValue() { final SWTBotView problemViewBot = bot.viewByTitle("Problems"); problemViewBot.setFocus(); final SWTBotTree problemTree = problemViewBot.bot().tree(); bot.waitUntil(new ICondition() { public boolean test() throws Exception { return (problemViewBot.isActive()) && (problemTree.getAllItems().length == 1); } public void init(SWTBot bot) { } public String getFailureMessage() { return "Problems view is not active."; } }); for (SWTBotTreeItem item : problemTree.getAllItems()) { item.expand(); for (String itemMessage : item.getNodes()) { if (errorMessage.equals(itemMessage)) { return true; } } } return false; }
Source:
<code>public void sendsRequestDirectly() throws Exception { final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, LastModifiedCachingWireTest.BODY ) ).next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, LastModifiedCachingWireTest.BODY ) ) .start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class).header( HttpHeaders.IF_MODIFIED_SINCE, "Fri, 01 Jan 2016 00:00:00 GMT" ); <START> for (int idx = 0; idx < 2; idx = idx + 1) { <END> req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody( Matchers.equalTo(LastModifiedCachingWireTest.BODY) ); } MatcherAssert.assertThat(container.queries(), Matchers.equalTo(2)); } finally { container.stop(); } }</code><technical_language>@amihaiemil ++idx</technical_language>

Target:
public void sendsRequestDirectly() throws Exception { final MkContainer container = new MkGrizzlyContainer() .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, LastModifiedCachingWireTest.BODY ) ) .next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, LastModifiedCachingWireTest.BODY ) ) .start(); try { final Request req = new JdkRequest(container.home()) .through(LastModifiedCachingWire.class).header( HttpHeaders.IF_MODIFIED_SINCE, "Fri, 01 Jan 2016 00:00:00 GMT" ); for (int idx = 0; idx < 2; ++idx) { req.fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .assertBody( Matchers.equalTo(LastModifiedCachingWireTest.BODY) ); } MatcherAssert.assertThat(container.queries(), Matchers.equalTo(2)); } finally { container.stop(); } }
Source:
<code>public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() { <START> return Objects.requireNonNull(nodeProperties); <END> }</code><technical_language>Nit: more sense throw IllegalStateException instead of NullPointerException</technical_language>

Target:
public DescribableList<NodeProperty<?>, NodePropertyDescriptor> getNodeProperties() { if (nodeProperties == null) throw new IllegalStateException(); return nodeProperties; }
Source:
<code>private boolean InternalCanDoAction() { boolean returnValue = false; try { Transaction transaction = TransactionSupport.suspend(); try { returnValue = IsUserAutorizedToRunAction() && IsBackwardsCompatible() && validateInputs() && acquireLock() && canDoAction(); if (this instanceof Quotable) { <START> returnValue &= ((Quotable) this).validateAndSetQuota(); <END> } if (!returnValue && getReturnValue().getCanDoActionMessages().size() > 0) { log.warnFormat("CanDoAction of action {0} failed. Reasons:{1}", getActionType(), StringHelper.aggregate(getReturnValue().getCanDoActionMessages(), ',')); } } finally { TransactionSupport.resume(transaction); } } catch (DataAccessException dataAccessEx) { log.error("Data access error during CanDoActionFailure.", dataAccessEx); addCanDoActionMessage(VdcBllMessages.CAN_DO_ACTION_DATABASE_CONNECTION_FAILURE); } catch (RuntimeException ex) { log.error("Error during CanDoActionFailure.", ex); addCanDoActionMessage(VdcBllMessages.CAN_DO_ACTION_GENERAL_FAILURE); } finally { if (!returnValue) { freeLock(); } } return returnValue; }</code><technical_language>canDoAction modifies quota? this sounds a bit counter intuitive</technical_language>

Target:
private boolean InternalCanDoAction() { boolean returnValue = false; try { Transaction transaction = TransactionSupport.suspend(); try { returnValue = IsUserAutorizedToRunAction() && IsBackwardsCompatible() && validateInputs() && acquireLock() && canDoAction(); if (this instanceof Quotable) { returnValue &= ((Quotable) this).validateAndSetQuota(); } if (!returnValue && getReturnValue().getCanDoActionMessages().size() > 0) { log.warnFormat("CanDoAction of action {0} failed. Reasons:{1}", getActionType(), StringUtils.join(getReturnValue().getCanDoActionMessages(), ',')); } } finally { TransactionSupport.resume(transaction); } } catch (DataAccessException dataAccessEx) { log.error("Data access error during CanDoActionFailure.", dataAccessEx); addCanDoActionMessage(VdcBllMessages.CAN_DO_ACTION_DATABASE_CONNECTION_FAILURE); } catch (RuntimeException ex) { log.error("Error during CanDoActionFailure.", ex); addCanDoActionMessage(VdcBllMessages.CAN_DO_ACTION_GENERAL_FAILURE); } finally { if (!returnValue) { freeLock(); } } return returnValue; }
Source:
<code>public void stateUpdated(Item item, State state) { setState(function.calculate(members)); setGroupState(new GroupType(item.getName(),GroupChange.CHANGED)); <START> <END> }</code><technical_language>IMHO remove empty line in front of a closing bracket</technical_language>

Target:
public void stateUpdated(Item item, State state) { State oldState = this.state; setState(function.calculate(members)); if (!oldState.equals(this.state)) { sendGroupStateChangedEvent(item.getName(), this.state, oldState); } }
Source:
<code>public void itCanFireWorkFailureEvent() throws Exception { int initCount = DummyPostCommitEventListener.handledCount(); int initEvtCount = DummyPostCommitEventListener.eventCount(); int initSyncEvntCount = WorkFailureEventListener.getCount(); int duration = 2000; SleepAndFailWork work = new SleepAndFailWork(0, false); service.schedule(work); assertTrue(service.awaitCompletion(duration * 3, TimeUnit.MILLISECONDS)); assertEquals(1 + initSyncEvntCount, WorkFailureEventListener.getCount()); <START> EventService eventService = Framework.getService(EventService.class); <END> eventService.waitForAsyncCompletion(); assertEquals(1 + initCount, DummyPostCommitEventListener.handledCount()); assertEquals(1 + initEvtCount, DummyPostCommitEventListener.eventCount()); }</code><technical_language>I missed this time. @Inject service instead of explicit lookup Framework.getService</technical_language>

Target:
public void itCanFireWorkFailureEvent() throws Exception { int initCount = DummyPostCommitEventListener.handledCount(); int initEvtCount = DummyPostCommitEventListener.eventCount(); int initSyncEvntCount = WorkFailureEventListener.getCount(); int duration = 2000; SleepAndFailWork work = new SleepAndFailWork(0, false); service.schedule(work); assertTrue(service.awaitCompletion(duration * 3, TimeUnit.MILLISECONDS)); assertEquals(1 + initSyncEvntCount, WorkFailureEventListener.getCount()); eventService.waitForAsyncCompletion(); assertEquals(1 + initCount, DummyPostCommitEventListener.handledCount()); assertEquals(1 + initEvtCount, DummyPostCommitEventListener.eventCount()); }
Source:
<code>public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protocols", e); } sslConfig.keyStore(CertificateUtils.createKeyStore(keyPem, certPem)); sslConfig.keyStorePassword("docker"); sslConfig.trustStore(CertificateUtils.createTrustStore(caPem)); } catch (Exception e) { <START> ClientLogger logger = new ClientLogger(getClass()); <END> throw logger.logExceptionAsError(new DockerClientException(e.getMessage(), e)); } }</code><technical_language>place define logger</technical_language>

Target:
public DockerSSLConfig(String caPem, String keyPem, String certPem) { try { Security.addProvider(new BouncyCastleProvider()); String e = System.getProperty("https.protocols"); System.setProperty("https.protocols", "TLSv1"); sslConfig = SslConfigurator.newInstance(true); if (e != null) { System.setProperty("https.protocols", e); } sslConfig.keyStore(CertificateUtils.createKeyStore(keyPem, certPem)); sslConfig.keyStorePassword("docker"); sslConfig.trustStore(CertificateUtils.createTrustStore(caPem)); } catch (Exception e) { throw new DockerClientException(e.getMessage(), e); } }
Source:
<code>public static String getDefaultLogFileCount() { return LOG_FILE_NUM_STRING; <START> } <END></code><technical_language>return int clients change a string if want to; is more natural return int</technical_language>

Target:
public static int getDefaultLogFileCount() { return LOG_FILE_NUM_INT; }
Source:
<code>public boolean delete(final String queryId) { final DAG<PhysicalVertex, StreamType.Direction> physicalPlan = physicalPlanMap.remove(queryId); try { planStore.delete(queryId); } catch (final IOException e) { e.printStackTrace(); } if (physicalPlan != null) { final Iterator<PhysicalVertex> iterator = GraphUtils.topologicalSort(physicalPlan); while (iterator.hasNext()) { final PhysicalVertex physicalVertex = iterator.next(); switch (physicalVertex.getType()) { case SOURCE: { final Source src = (Source)physicalVertex; try { src.close(); } catch (final Exception e) { <START> e.printStackTrace(); <END> } src.getEventGenerator().setOutputEmitter(null); break; } case OPERATOR_CHIAN: { final PartitionedQuery partitionedQuery = (PartitionedQuery)physicalVertex; partitionedQueryManager.delete(partitionedQuery); partitionedQuery.setOutputEmitter(null); break; } case SINK: { final Sink sink = (Sink)physicalVertex; try { sink.close(); } catch (final Exception e) { e.printStackTrace(); } break; } default: throw new RuntimeException("Invalid Vertex Type: " + physicalVertex.getType()); } } return true; } return false; }</code><technical_language>If combine delete method deleteChainedPlan method, saved logical plan deleted call stop method</technical_language>

Target:
public boolean delete(final String queryId) { try { planStore.delete(queryId); } catch (final IOException e) { e.printStackTrace(); return false; } return deleteQueryFromManager(queryId); }
Source:
<code>protected void emitAnchorHref(String href) { String[] names = href.split("/"); String name = names[names.length - 1]; <START> if (convertMarkupPageLinks && name.indexOf('.') == -1 && !ABSOLUTE_URL_PATTERN.matcher(href).matches()) { <END> int split = href.indexOf('#'); if (split > 0) { href = getHtmlFilenameFormat().replace("$1", href.substring(0, split)) + href.substring(split); } else if (split == -1) { href = getHtmlFilenameFormat().replace("$1", href); } } writer.writeAttribute("href", makeUrlAbsolute(href)); }</code><technical_language>* Move check of convertMarkupPageLinks flag href.split safe some CPU cycles. * Consider extracting this string matching code method. If static pass htmlFilenameFormat easily unit tested</technical_language>

Target:
protected void emitAnchorHref(String href) { if (getHtmlFilenameFormat() != null) { if (isRelativeMissingFileSuffix(href)) { int split = href.indexOf('#'); if (split > 0) { href = getHtmlFilenameFormat().replace("$1", href.substring(0, split)) + href.substring(split); } else if (split == -1) { href = getHtmlFilenameFormat().replace("$1", href); } } } writer.writeAttribute("href", makeUrlAbsolute(href)); }
Source:
<code>static <T> Iterator<T> iterate(T seed, Function<? super T, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return new AbstractIterator<T>() { <START> Function<? super T, ? extends T> nextFunc = (s) -> seed; <END> T previous = null; @Override public boolean hasNext() { return true; } @Override public T getNext() { previous = nextFunc.apply(previous); nextFunc = f; return previous; } }; }</code><technical_language>I agree iterator totally lazy, thanks for providing a PR. However, simpler if implemented a supplier, e.g.: java return new AbstractIterator<T>() { T current; @Override public boolean hasNext() { return true; } @Override public T getNext() { current = (current == null) ? seed : f.apply(current); return current; } };</technical_language>

Target:
static <T> Iterator<T> iterate(T seed, Function<? super T, ? extends T> f) { Objects.requireNonNull(f, "f is null"); return new AbstractIterator<T>() { Function<? super T, ? extends T> nextFunc = s -> { nextFunc = f; return seed; }; T current = null; @Override public boolean hasNext() { return true; } @Override public T getNext() { current = nextFunc.apply(current); return current; } }; }
Source:
<code>public static PayReceive parsePayReceive(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "PAY": case "P": return PayReceive.PAY; case "RECEIVE": case "REC": case "R": return PayReceive.RECEIVE; default: <START> throw new IllegalArgumentException("Unknown PayReceive value, must 'Pay' or 'Receive' but was '" + str + "'"); <END> } }</code><technical_language>Missing "be", slightly misleading</technical_language>

Target:
public static PayReceive parsePayReceive(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "PAY": case "P": return PayReceive.PAY; case "RECEIVE": case "REC": case "R": return PayReceive.RECEIVE; default: throw new IllegalArgumentException( "Unknown PayReceive value, must be 'Pay' or 'Receive' but was '" + str + "'; " + "parser is case insensitive and also accepts 'P', 'Rec' and 'R'"); } }
Source:
<code>private FanoutBucket asFanout(InMemoryNoteBucket bucket) throws IOException { if (bucket == null) return EMPTY_FANOUT; if (bucket instanceof FanoutBucket) return (FanoutBucket) bucket; FanoutBucket fanoutBucket = ((LeafBucket) bucket).split(); <START> fanoutBucket.writeTree(inserter); <END> return fanoutBucket; }</code><technical_language>I if need this call anymore. I understand code works, this temporary fanout bucket needed a tree anywhere, write it</technical_language>

Target:
private FanoutBucket asFanout(InMemoryNoteBucket bucket) { if (bucket == null) return EMPTY_FANOUT; if (bucket instanceof FanoutBucket) return (FanoutBucket) bucket; FanoutBucket fanoutBucket = ((LeafBucket) bucket).split(); return fanoutBucket; }
Source:
<code><START> void assertCorrectCount(RankedBitVector bv, long position) { <END> { long expectedCount = countBits(bv, false, position); long computedCount = countBits(bv, false, position); Assert.assertEquals(expectedCount, computedCount); } { long expectedCount = countBits(bv, true, position); long computedCount = countBits(bv, true, position); Assert.assertEquals(expectedCount, computedCount); } }</code><technical_language>This test anything. compares values themselves. Btw, this test coverage in EclEmma, a coverage for CountBitArray</technical_language>

Target:
void assertCorrectCount(RankedBitVector bv, long position) { long expectedCountBitsFalse = countBits(bv, false, position); long computedCountBitsFalse = bv.countBits(false, position); Assert.assertEquals(expectedCountBitsFalse, computedCountBitsFalse); long expectedCountBitsTrue = countBits(bv, true, position); long computedCountBitsTrue = bv.countBits(true, position); Assert.assertEquals(expectedCountBitsTrue, computedCountBitsTrue); }
Source:
<code>public CacheConfiguration(int size, int ttl) { this.size = Math.max(10, Math.min(size, 1000)); this.ttl = Math.max(30, Math.min(ttl, 3600)); <START> } <END></code><technical_language>disable</technical_language>

Target:
public CacheConfiguration(int size, int ttl) { this.size = Math.max(0, Math.min(size, 1000)); this.ttl = Math.max(0, Math.min(ttl, 3600)); this.userCache = CacheBuilder.newBuilder() .maximumSize(getSize()) .expireAfterWrite(getTtl(), TimeUnit.SECONDS) .build(); this.groupCache = CacheBuilder.newBuilder() .maximumSize(getSize()) .expireAfterWrite(getTtl(), TimeUnit.SECONDS) .build(); }
Source:
<code>public void updateBuildingInfo() { IStatementParameter[] params = new IStatementParameter[pattern.maxParams]; for (int i = 0; i < params.length; i++) { params[i] = pattern.get(i); } FilledTemplate patternTemplate = pattern.get().createTemplate(this, params); if (patternTemplate == null) { buildingInfo = null; } else { Template blueprintTemplate = new Template(); blueprintTemplate.size = patternTemplate.size; blueprintTemplate.offset = BlockPos.ORIGIN; int sx = patternTemplate.sizeX; int sy = patternTemplate.sizeY; int sz = patternTemplate.sizeZ; blueprintTemplate.data = new BitSet(); for (int x = 0; x < sx; x++) { for (int y = 0; y < sy; y++) { for (int z = 0; z < sz; z++) { <START> blueprintTemplate.data.set(blueprintTemplate.posToIndex(x, y, z), patternTemplate.get(x, y, z) ^ inverted); <END> } } } buildingInfo = blueprintTemplate.new BuildingInfo(patternTemplate.min, Rotation.NONE); } }</code><technical_language>give access original BitSet, copy BitSet#flip if needed</technical_language>

Target:
public void updateBuildingInfo() { IStatementParameter[] params = new IStatementParameter[pattern.maxParams]; for (int i = 0; i < params.length; i++) { params[i] = pattern.get(i); } FilledTemplate patternTemplate = pattern.get().createTemplate(this, params); if (patternTemplate == null) { buildingInfo = null; } else { Template blueprintTemplate = new Template(); blueprintTemplate.size = patternTemplate.size; blueprintTemplate.offset = BlockPos.ORIGIN; blueprintTemplate.data = patternTemplate; if (inverted) { blueprintTemplate.data.invert(); } buildingInfo = blueprintTemplate.new BuildingInfo(patternTemplate.min, Rotation.NONE); } }
Source:
<code>protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); ChatDisplayer chatDisplayer = (ChatDisplayer) findViewById(R.id.chatView); presenter = new ChatPresenter( Dependencies.INSTANCE.getLoginService(), Dependencies.INSTANCE.getChatService(), chatDisplayer, getIntent().getStringExtra(NAME_EXTRA), <START> (Channel.Access) getIntent().getSerializableExtra(ACCESS_EXTRA), <END> Dependencies.INSTANCE.getFirebaseAnalytics(), new AndroidNavigator(this) ); }</code><technical_language>pass string</technical_language>

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_chat); ChatDisplayer chatDisplayer = (ChatDisplayer) findViewById(R.id.chatView); Channel channel = new Channel(getIntent().getStringExtra(NAME_EXTRA), Channel.Access.valueOf(getIntent().getStringExtra(ACCESS_EXTRA))); presenter = new ChatPresenter( Dependencies.INSTANCE.getLoginService(), Dependencies.INSTANCE.getChatService(), chatDisplayer, channel, Dependencies.INSTANCE.getFirebaseAnalytics(), new AndroidNavigator(this) ); }
Source:
<code>public void success(Result<String> emailResult) { <START> mCallbackObject.get().onSuccess(createIdpResponse(emailResult.data)); <END> }</code><technical_language>need check if mCallbackObject.get() is null calling onSuccess avoid a NPE. null I guess log a warning do nothing, means activity waiting for callback dead deliver it</technical_language>

Target:
public void success(Result<String> emailResult) { onSuccess(createIdpResponse(emailResult.data)); }
Source:
<code>public void testMergeDisabled() throws Exception { <START> ElasticsearchBeyonder.start(client, "elasticsearch"); <END> String expectedMapping = getMapping("twitter"); ElasticsearchBeyonder.start(client, "models/mergedisabled", false, false); String actualMapping = getMapping("twitter"); assertThat(actualMapping, is(expectedMapping)); }</code><technical_language>fact default path name is elasticsearch, I call instead: java ElasticsearchBeyonder.start(client); important IDE stop proposing making start(RestClient) a private method ;)</technical_language>

Target:
public void testMergeDisabled() throws Exception { ElasticsearchBeyonder.start(client); String expectedMapping = getMapping("twitter"); ElasticsearchBeyonder.start(client, "models/mergedisabled", false, false); String actualMapping = getMapping("twitter"); assertThat(actualMapping, is(expectedMapping)); }
Source:
<code>public static void setUp() { Map<String, String> config = Maps.newHashMap(); <START> config.put("schema.registry.url", "http://localhost"); <END> KafkaAvroSerializer avroSerializer = new KafkaAvroSerializer(new MockSchemaRegistryClient()); avroSerializer.configure(config, false); simpleRecord1AsBytes = avroSerializer.serialize("temp", simpleRecord1); }</code><technical_language>Nit: AbstractAvroSerdeConfig a constant for this property Also, add :8081 for port</technical_language>

Target:
public static void setUp() { Map<String, String> config = Maps.newHashMap(); config.put(AbstractKafkaAvroSerDeConfig.SCHEMA_REGISTRY_URL_CONFIG, "http://localhost:8081"); KafkaAvroSerializer avroSerializer = new KafkaAvroSerializer(new MockSchemaRegistryClient()); avroSerializer.configure(config, false); simpleRecordConfluentBytes = avroSerializer.serialize("temp", simpleRecord); }
Source:
<code><START> public WebSocketClientHandshaker13(URI webSocketURL, WebSocketVersion version, String subprotocol, <END> boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }</code><technical_language>this package-private for</technical_language>

Target:
WebSocketClientHandshaker13(URI webSocketURL, WebSocketVersion version, String subprotocol, boolean allowExtensions, HttpHeaders customHeaders, int maxFramePayloadLength, boolean performMasking, boolean allowMaskMismatch, long forceCloseTimeoutMillis, boolean absoluteUpgradeUrl, String httpRequestEncoderName, String httpResponseDecoderName) { super(webSocketURL, version, subprotocol, customHeaders, maxFramePayloadLength, forceCloseTimeoutMillis, absoluteUpgradeUrl, httpRequestEncoderName, httpResponseDecoderName); this.allowExtensions = allowExtensions; this.performMasking = performMasking; this.allowMaskMismatch = allowMaskMismatch; }
Source:
<code>public List<Task> getActiveTasks() { giant.lock(); try { final ImmutableList.Builder<Task> listBuilder = ImmutableList.builder(); for (final TaskStuff taskStuff : tasks.values()) { <START> if (taskStuff.getStatus().isRunnable() && taskStuff.getTask() != null) { <END> listBuilder.add(taskStuff.getTask()); } } return listBuilder.build(); } finally { giant.unlock(); } }</code><technical_language>I guess task is null in HeapMemoryTaskStorage</technical_language>

Target:
public List<Task> getActiveTasks() { giant.lock(); try { final ImmutableList.Builder<Task> listBuilder = ImmutableList.builder(); for (final TaskStuff taskStuff : tasks.values()) { if (taskStuff.getStatus().isRunnable()) { listBuilder.add(taskStuff.getTask()); } } return listBuilder.build(); } finally { giant.unlock(); } }
Source:
<code>public void exitClassifierSetType(ClassifierSetTypeContext ctx) { final int nbTypes = (ctx.getChildCount() + 1) / 2 - 1; final TypeLiteral[] types = new TypeLiteral[nbTypes]; <START> for (int i = nbTypes - 1; i >= 0; --i) { <END> types[i] = popTypeLiteral(); } final TypeSetLiteral classifierSetType = builder.typeSetLiteral(Arrays.asList(types)); startPositions.put(classifierSetType, Integer.valueOf(ctx.start.getStartIndex())); endPositions.put(classifierSetType, Integer.valueOf(ctx.stop.getStopIndex() + 1)); push(classifierSetType); }</code><technical_language>-i is strictly identical i-- in this context, please usual 'i--' form</technical_language>

Target:
public void exitClassifierSetType(ClassifierSetTypeContext ctx) { final int nbTypes = (ctx.getChildCount() + 1) / 2 - 1; final TypeLiteral[] types = new TypeLiteral[nbTypes]; for (int i = nbTypes - 1; i >= 0; i--) { types[i] = popTypeLiteral(); } final TypeSetLiteral classifierSetType = builder.typeSetLiteral(Arrays.asList(types)); startPositions.put(classifierSetType, Integer.valueOf(ctx.start.getStartIndex())); endPositions.put(classifierSetType, Integer.valueOf(ctx.stop.getStopIndex() + 1)); push(classifierSetType); }
Source:
<code>private void expandFetchTags() throws TransportException { final Map<String, Ref> haveRefs = localRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) { continue; } final Ref local = haveRefs.get(r.getName()); <START> ObjectId localId = local != null ? local.getObjectId() : null; if (localId == null || !localId.equals(r.getObjectId())) { wantTag(r); } <END> } }</code><technical_language>r.getObjectId is non-null in-tree transports. (The transport advertises a ref object id is 'dumb http', for HEAD.) if r.getObjectId is null, strange is happening. a of fetching symrefs opposed targets, adding a tag a 'want' accomplish anything. about: ObjectId id = r.getObjectId(); if (id == null) { continue; } Ref local = haveRefs.get(r.getName()); if (local == null || !id.equals(local.getObjectId()) { wantTag(r); }</technical_language>

Target:
private void expandFetchTags() throws TransportException { final Map<String, Ref> haveRefs = localRefs(); for (final Ref r : conn.getRefs()) { if (!isTag(r)) { continue; } ObjectId id = r.getObjectId(); if (id == null) { continue; } final Ref local = haveRefs.get(r.getName()); if (local == null || !id.equals(local.getObjectId())) { wantTag(r); } } }
Source:
<code>public void convertAll() { File[] inputFiles = inputDir.listFiles(); if (inputFiles == null) { inputFiles = new File[] {}; } <START> <END> Arrays.sort(inputFiles, new ProblemFileComparator()); for (File inputFile : inputFiles) { if (acceptInputFile(inputFile)) { convert(inputFile); } } }</code><technical_language>Trailing whitespace</technical_language>

Target:
public void convertAll() { File[] inputFiles = inputDir.listFiles(); if (inputFiles == null) { throw new IllegalStateException("Unable to list files in a directory (" + inputDir.getAbsolutePath() + ")."); } Arrays.sort(inputFiles, new ProblemFileComparator()); for (File inputFile : inputFiles) { if (acceptInputFile(inputFile)) { convert(inputFile); } } }
Source:
<code>private List<Assignment> queryForAssignments(Assignment assignment) { <START> String query = ""; <END> if (assignment.getUserName() != null && !assignment.getUserName().equals("")) { query += "userName:\"" + assignment.getUserName() + "\""; } if (assignment.getProjectName() != null && !assignment.getProjectName().equals("")) { query += "projectName:\"" + assignment.getProjectName() + "\""; } preparePersistenceAccess(); List<Assignment> result = queryService.queryByString(Assignment.class, query); revokePersistenceAccess(); return result; }</code><technical_language>query(QueryRequest) method</technical_language>

Target:
private List<Assignment> queryForAssignments(Assignment assignment) { QueryRequest request = QueryRequest.create(); if (assignment.getUserName() != null && !assignment.getUserName().equals("")) { request.addParameter("userName", assignment.getUserName()); } if (assignment.getProjectName() != null && !assignment.getProjectName().equals("")) { request.addParameter("projectName", assignment.getProjectName()); } preparePersistenceAccess(); List<Assignment> result = queryService.query(Assignment.class, request); revokePersistenceAccess(); return result; }
Source:
<code>public CatalogProtos.HistogramProto getProto() { <START> CatalogProtos.HistogramProto.Builder builder = CatalogProtos.HistogramProto.newBuilder(); <END> if (this.lastAnalyzed != null) { builder.setLastAnalyzed(this.lastAnalyzed); } if (this.buckets != null) { for (HistogramBucket bucket : buckets) { builder.addBuckets(bucket.getProto()); } } return builder.build(); }</code><technical_language>'isReady' variable is missing</technical_language>

Target:
public CatalogProtos.HistogramProto getProto() { CatalogProtos.HistogramProto.Builder builder = CatalogProtos.HistogramProto.newBuilder(); if (this.lastAnalyzed != null) { builder.setLastAnalyzed(this.lastAnalyzed); } if (this.dataType != null) { builder.setDataType(this.dataType); } if (this.buckets != null) { for (HistogramBucket bucket : buckets) { builder.addBuckets(bucket.getProto()); } } return builder.build(); }
Source:
<code>public void testCallWebServiceFromProcess() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("serviceUrl", TestConfig.getBaseHttpURL() + "/kie-server-test-web-service/AcmeDemoInterface?wsdl"); Long pid = processClient.startProcess(WS_CONTAINER_ID, PROCESS_ID_WS, params); <START> <END> assertThat(pid).isNotNull(); ProcessInstance pi = queryClient.findProcessInstanceById(pid); assertThat(pi.getState()).isEqualTo(STATE_COMPLETED); }</code><technical_language>check resultFlight variable for content</technical_language>

Target:
public void testCallWebServiceFromProcess() throws Exception { Map<String, Object> params = new HashMap<>(); params.put("serviceUrl", TestConfig.getWebServiceHttpURL()); Long pid = processClient.startProcess(WS_CONTAINER_ID, PROCESS_ID_WS, params); assertThat(pid).isNotNull(); ProcessInstance pi = queryClient.findProcessInstanceById(pid); assertThat(pi.getState()).isEqualTo(STATE_COMPLETED); }
Source:
<code>public void createContest(CodingcontestDto dto){ <START> Challenge challenge = new Challenge(); <END> challenge.setName(dto.getName()); challenge.setCanonicalName("ccc-" + dto.getLocation() + "-" + dto.getGameName()); challenge.setChallengeTemplate(null); challenge.setStartDate(ZonedDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); challenge = challengeRepository.save(challenge); for(ParticipationDto participation: dto.getParticipations()){ User user = mapParticipationDto(participation); user.addInvitedChallenge(challenge); userRepository.save(user); } }</code><technical_language>create a new challenge everytime button hit, this is for updating contest</technical_language>

Target:
public void createContest(CodingcontestDto dto) { UUID id = UUID.fromString(dto.getUuid()); Challenge challenge = challengeRepository.findOne(id); if (challenge == null) { challenge.setId(id); challenge.setName(dto.getName()); challenge.setCanonicalName("ccc-" + dto.getLocation() + "-" + dto.getGameName()); challenge.setChallengeTemplate(challengeTemplateRepository.findOneByNick(dto.getGameName())); challenge.setStartDate(ZonedDateTime.ofInstant(dto.getStartTime().toInstant(), ZoneId.systemDefault())); challenge = challengeRepository.save(challenge); } for (ParticipationDto participation : dto.getParticipations()) { User user = mapParticipationDto(participation); user.addInvitedChallenge(challenge); userRepository.save(user); } }
Source:
<code>public String toString() { <START> return String.format("%s%s%s%s%s", checkpointId, SEPARATOR, changelogOffset); <END> }</code><technical_language>Remove extra %s</technical_language>

Target:
public String toString() { return String.format("%s%s%s", checkpointId, SEPARATOR, changelogOffset); }
Source:
<code>public Config newConfig() { <START> return newConfig(String.valueOf(System.currentTimeMillis())); <END> }</code><technical_language>necessary implement here</technical_language>

Target:
public Config newConfig() { String id = this.getProviderId() + "." + System.currentTimeMillis(); return new Config(id, null, null, null); }
Source:
<code>private static <T> T getField(Object object, String fieldName, Class<T> fieldType, T defaultValue) { try { Field field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); return fieldType.cast(field.get(object)); <START> } catch (NoSuchFieldException e) { <END> } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } return defaultValue; }</code><technical_language>Please multi-catch JDK7</technical_language>

Target:
private static <T> T getField(Object object, String fieldName, Class<T> fieldType, T defaultValue) { Field field; try { field = object.getClass().getDeclaredField(fieldName); field.setAccessible(true); return fieldType.cast(field.get(object)); } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { } return defaultValue; }
Source:
<code>public boolean isValid(CruiseConfig preprocessedConfig) { preprocessedRole = preprocessedConfig.server().security().getRoles().findByNameAndType(role.getName(), role.getClass()); preprocessedRole.validateTree(RolesConfigUpdateValidator.validationContextWithSecurityConfig(preprocessedConfig)); <START> List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedRole); BasicCruiseConfig.copyErrors(preprocessedRole, role); return allErrors.isEmpty(); <END> }</code><technical_language>BasicCruiseConfig.copyErrors is iterator config object. avoid traversing entire config object (including children) if errors changing this to: java List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedRole); boolean isEmpty = allErrors.isEmpty(); if(!isEmpty) { BasicCruiseConfig.copyErrors(preprocessedRole, role); } return isEmpty;</technical_language>

Target:
public boolean isValid(CruiseConfig preprocessedConfig) { preprocessedRole = preprocessedConfig.server().security().getRoles().findByNameAndType(role.getName(), role.getClass()); preprocessedRole.validateTree(RolesConfigUpdateValidator.validationContextWithSecurityConfig(preprocessedConfig)); List<ConfigErrors> allErrors = ErrorCollector.getAllErrors(preprocessedRole); boolean isEmpty = allErrors.isEmpty(); if (!isEmpty) { BasicCruiseConfig.copyErrors(preprocessedRole, role); } return isEmpty; }
Source:
<code>public void updateModel(@NonNull Model model) { this.shouldUpdate.set(true); modelLock.writeLock().lock(); if (replicatedModel instanceof MultiLayerNetwork) { replicatedModel.setParams(model.params().unsafeDuplication(true)); Updater updater = ((MultiLayerNetwork) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { updater = ((MultiLayerNetwork) replicatedModel).getUpdater(); INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater.setStateViewArray((MultiLayerNetwork) replicatedModel, viewD, false); } } else if (replicatedModel instanceof ComputationGraph) { replicatedModel.setParams(model.params().unsafeDuplication(true)); ComputationGraphUpdater updater = ((ComputationGraph) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater = ((ComputationGraph) replicatedModel).getUpdater(); updater.setStateViewArray(viewD); } } Nd4j.getExecutioner().commit(); <START> modelLock.writeLock().unlock(); <END> }</code><technical_language>Unlock in finally block? if sort of exception, other threads waiting lock waiting forever</technical_language>

Target:
public void updateModel(@NonNull Model model) { this.shouldUpdate.set(true); try { modelLock.writeLock().lock(); if (replicatedModel instanceof MultiLayerNetwork) { replicatedModel.setParams(model.params().unsafeDuplication(true)); Updater updater = ((MultiLayerNetwork) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { updater = ((MultiLayerNetwork) replicatedModel).getUpdater(); INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater.setStateViewArray((MultiLayerNetwork) replicatedModel, viewD, false); } } else if (replicatedModel instanceof ComputationGraph) { replicatedModel.setParams(model.params().unsafeDuplication(true)); ComputationGraphUpdater updater = ((ComputationGraph) model).getUpdater(); INDArray view = updater.getStateViewArray(); if (view != null) { INDArray viewD = view.dup(); Nd4j.getExecutioner().commit(); updater = ((ComputationGraph) replicatedModel).getUpdater(); updater.setStateViewArray(viewD); } } Nd4j.getExecutioner().commit(); } finally { modelLock.writeLock().unlock(); } }
Source:
<code>public boolean updateDatamodel(Item item) { boolean modified = false; if (item != null && item instanceof WSDataModelItem && accept(item)) { WSDataModelItem modelItem = (WSDataModelItem) item; EList<ReferenceFileItem> resources = modelItem.getReferenceResources(); for (ReferenceFileItem fileItem : resources) { if (fileItem.getExtension().equals("xsd")) { ByteArray content = fileItem.getContent(); String xsdSchema = doUpdate(content.getInnerContent()); if (xsdSchema != null) { try { byte[] byteContent = xsdSchema.getBytes("utf-8"); content.setInnerContent(byteContent); modelItem.getWsDataModel().setXsdSchema(new String(byteContent, "utf-8")); } catch (UnsupportedEncodingException e) { <START> LOG.error("Failed to Encodes/Decodes string by 'utf-8' encoding.", e); END> } modified = true; } break; } } if (modified) { RepositoryResourceUtil.saveItem(item); } } return modified; }</code><technical_language>Failed encode/decode string 'utf-8' encoding</technical_language>

Target:
public boolean updateDatamodel(Item item) { boolean modified = false; if (item != null && item instanceof WSDataModelItem && accept(item)) { WSDataModelItem modelItem = (WSDataModelItem) item; EList<ReferenceFileItem> resources = modelItem.getReferenceResources(); for (ReferenceFileItem fileItem : resources) { if (fileItem.getExtension().equals("xsd")) { ByteArray content = fileItem.getContent(); String xsdSchema = doUpdate(content.getInnerContent()); if (xsdSchema != null) { try { byte[] byteContent = xsdSchema.getBytes("utf-8"); content.setInnerContent(byteContent); modelItem.getWsDataModel().setXsdSchema(new String(byteContent, "utf-8")); } catch (UnsupportedEncodingException e) { LOG.error("Failed to encode/decode string by 'utf-8' encoding.", e); } modified = true; } break; } } if (modified) { RepositoryResourceUtil.saveItem(item); } } return modified; }
Source:
<code>private static boolean isAccessor(MethodDeclarationTree tree) { return ((BlockTree) tree.body()).statements().size() == 1 <START> && (tree.name().text().startsWith("set") || tree.name().text().startsWith("get") || tree.name().text().startsWith("is")); <END> }</code><technical_language>extract tree.name().text() a variable</technical_language>

Target:
private static boolean isAccessor(MethodDeclarationTree tree) { String methodName = tree.name().text(); return ((BlockTree) tree.body()).statements().size() == 1 && (methodName.startsWith("set") || methodName.startsWith("get") || methodName.startsWith("is")); }