auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid, boolean compress) throws ServletException, IOException { final String sid = request.getHeader("ZK-SID"); if (sid != null) { try { Integer.parseInt(sid); } catch (NumberFormatException e) { <START> responseError(request, response, null); <END> return; } response.setHeader("ZK-SID", sid); } final AuWriter out = AuWriters.newInstance(); out.setCompress(compress); out.open(request, response); if (!getAuDecoder(wapp).isIgnorable(request, wapp)) { final String deviceType = getDeviceType(request); URIInfo ui = wapp != null ? wapp.getConfiguration().getTimeoutURI(deviceType) : null; String uri = ui != null ? ui.uri : null; out.write(new AuConfirmClose(null)); final AuResponse resp; if (uri != null) { if (uri.length() != 0) uri = Encodes.encodeURL(getServletContext(), request, response, uri); resp = new AuSendRedirect(uri, null); } else { String msg = wapp.getConfiguration().getTimeoutMessage(deviceType); dtid = XMLs.encodeText(dtid); if (msg != null && msg.startsWith("label:")) { final String key; msg = Labels.getLabel(key = msg.substring(6), new Object[] { dtid }); if (msg == null) log.warn("Label not found, " + key); } if (msg == null) msg = Messages.get(MZk.UPDATE_OBSOLETE_PAGE, dtid); resp = new AuObsolete(dtid, msg); } out.write(resp); } out.close(request, response); }</code><technical_language>"Illegal request"</technical_language>

Target:
private void sessionTimeout(HttpServletRequest request, HttpServletResponse response, WebApp wapp, String dtid, boolean compress) throws ServletException, IOException { final String sid = request.getHeader("ZK-SID"); if (sid != null) { try { Integer.parseInt(sid); } catch (NumberFormatException e) { log.warn("", e); responseError(request, response, "Illegal request"); return; } response.setHeader("ZK-SID", sid); } final AuWriter out = AuWriters.newInstance(); out.setCompress(compress); out.open(request, response); if (!getAuDecoder(wapp).isIgnorable(request, wapp)) { final String deviceType = getDeviceType(request); URIInfo ui = wapp != null ? wapp.getConfiguration().getTimeoutURI(deviceType) : null; String uri = ui != null ? ui.uri : null; out.write(new AuConfirmClose(null)); final AuResponse resp; if (uri != null) { if (uri.length() != 0) uri = Encodes.encodeURL(getServletContext(), request, response, uri); resp = new AuSendRedirect(uri, null); } else { String msg = wapp.getConfiguration().getTimeoutMessage(deviceType); dtid = XMLs.encodeText(dtid); if (msg != null && msg.startsWith("label:")) { final String key; msg = Labels.getLabel(key = msg.substring(6), new Object[] { dtid }); if (msg == null) log.warn("Label not found, " + key); } if (msg == null) msg = Messages.get(MZk.UPDATE_OBSOLETE_PAGE, dtid); resp = new AuObsolete(dtid, msg); } out.write(resp); } out.close(request, response); }
Source:
<code>public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { HPCCJDBCUtils.traceoutln(TraceLevel.VERBOSE, "HPCCResultSet updateShort( " + columnIndex + " )" ); <START> throw new UnsupportedOperationException("EclResultSet: Not supported yet."); <END> }</code><technical_language>this throws include unsupported method name? (see line 1194)</technical_language>

Target:
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { HPCCJDBCUtils.traceoutln(Level.FINEST, "HPCCResultSet updateShort( " + columnIndex + " )" ); throw new UnsupportedOperationException("HPCCResultSet: updateShort Not supported yet."); }
Source:
<code>public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { NetRCEntry cc = netrc.entry(uri.getHost()); if (cc == null) return false; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(cc.login); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue(cc.password); continue; } if (i instanceof CredentialItem.StringType) { if (i.getPromptText().equals("Password: ")) { <START> ((CredentialItem.StringType) i).setValue(new String( <END> cc.password)); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; }</code><technical_language>CharArrayType instead avoid constructing a String a password</technical_language>

Target:
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { NetRCEntry cc = netrc.getEntry(uri.getHost()); if (cc == null) return false; for (CredentialItem i : items) { if (i instanceof CredentialItem.Username) { ((CredentialItem.Username) i).setValue(cc.login); continue; } if (i instanceof CredentialItem.Password) { ((CredentialItem.Password) i).setValue(cc.password); continue; } if (i instanceof CredentialItem.StringType) { if (i.getPromptText().equals("Password: ")) { ((CredentialItem.StringType) i).setValue(new String( cc.password)); continue; } } throw new UnsupportedCredentialItem(uri, i.getClass().getName() + ":" + i.getPromptText()); } return true; }
Source:
<code><START> public Control getParent() { <END> return fParent; }</code><technical_language>fParent protected. getter protected then</technical_language>

Target:
protected Control getParent() { return fParent; }
Source:
<code>public KafkaCollector(Properties props, String jobName, String topicName) throws IOException { super(props, jobName, topicName); this.topicAndHour = props.getProperty(TOPIC_AND_HOUR); this.fs = FileSystem.get(job.getConfiguration()); this.inputPaths = getInputPaths(); this.tmpPath = new Path(job.getConfiguration().get(TMP_PATH)); this.outputPath = new Path(job.getConfiguration().get(DEST_PATH)); <START> addInputAndOutputPathsToFileInputFormat(); <END> }</code><technical_language>more sense do props.getProperty("prop_name") job.getConfiguration().get("prop_name")</technical_language>

Target:
public KafkaCollector(Properties props, String jobName, String topicName) throws IOException { super(props, jobName, topicName); this.topicAndHour = props.getProperty(TOPIC_AND_HOUR); }
Source:
<code>private void enforceTimeLimits() { for (T query : queries.values()) { if (query.isDone()) { continue; } <START> Duration queryMaxRunTime = SystemSessionProperties.getQueryMaxRunTime(query.getSession()); <END> Duration queryMaxExecutionTime = SystemSessionProperties.getQueryMaxExecutionTime(query.getSession()); Optional<DateTime> executionStartTime = query.getExecutionStartTime(); DateTime createTime = query.getCreateTime(); if (executionStartTime.isPresent() && executionStartTime.get().plus(queryMaxExecutionTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded the maximum execution time limit of " + queryMaxExecutionTime)); } if (createTime.plus(queryMaxRunTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded maximum time limit of " + queryMaxRunTime)); } } }</code><technical_language>I looked this previously, static imported</technical_language>

Target:
private void enforceTimeLimits() { for (T query : queries.values()) { if (query.isDone()) { continue; } Duration queryMaxRunTime = getQueryMaxRunTime(query.getSession()); Duration queryMaxExecutionTime = getQueryMaxExecutionTime(query.getSession()); Optional<DateTime> executionStartTime = query.getExecutionStartTime(); DateTime createTime = query.getCreateTime(); if (executionStartTime.isPresent() && executionStartTime.get().plus(queryMaxExecutionTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded the maximum execution time limit of " + queryMaxExecutionTime)); } if (createTime.plus(queryMaxRunTime.toMillis()).isBeforeNow()) { query.fail(new PrestoException(EXCEEDED_TIME_LIMIT, "Query exceeded maximum time limit of " + queryMaxRunTime)); } } }
Source:
<code>private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (!useTagsInFrom) { return false; } Boolean result = requiresFullTable.containsKey(obj + "-" + fieldName); if (result != null && result) { return true; } <START> return false; <END> }</code><technical_language>IMO more readable : private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (useTagsInFrom) { return requiresFullTable.containsKey(obj + "-" + fieldName); } return false; }</technical_language>

Target:
private boolean requiresTagsForField(String obj, String fieldName, boolean useTagsInFrom) { if (useTagsInFrom) { return requiresFullTable.containsKey(obj + "-" + fieldName); } return false; }
Source:
<code>public void start() { if (plannerConfig.isMetadataSegmentCacheEnable()) { <START> scheduledExec = Execs.scheduledSingleThreaded("MetadataSegmentView-Cache--%d"); <END> scheduledExec.schedule(new PollTask(), 0, TimeUnit.MILLISECONDS); } }</code><technical_language>I this needs some sort of synchronization started check, a LifecycleLock if start stop service, lock AtomicBoolean if stop start while service is running</technical_language>

Target:
public void start() { if (!lifecycleLock.canStart()) { throw new ISE("can't start."); } try { if (isCacheEnabled) { scheduledExec.schedule(new PollTask(), pollPeriodInMS, TimeUnit.MILLISECONDS); } lifecycleLock.started(); log.info("MetadataSegmentView Started."); } finally { lifecycleLock.exitStart(); } }
Source:
<code>public void should_diff_with_empty_table() { try { DataTable emptyTable = DataTable.create(Collections.emptyList()); table().diff(emptyTable); <START> } catch (IndexOutOfBoundsException e) { <END> String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }</code><technical_language>expecting test throw a TableDiffException catching IndexOutOfBoundsException. I this is right</technical_language>

Target:
public void should_diff_with_empty_table() { try { DataTable emptyTable = DataTable.create(Collections.emptyList()); table().diff(emptyTable); } catch (TableDiffException e) { String expected = "" + "Tables were not identical:\n" + " - | Aslak | aslak@email.com | 123 |\n" + " - | Joe | joe@email.com | 234 |\n" + " - | Bryan | bryan@email.org | 456 |\n" + " - | Ni | ni@email.com | 654 |\n"; assertEquals(expected, e.getMessage()); throw e; } }
Source:
<code>public void testStringWithoutTrailingZero() { <START> assertEquals("0", NumberFormats.stringWithoutTrailingZero(String.valueOf(0))); <END> assertEquals("8", NumberFormats.stringWithoutTrailingZero(String.valueOf(8))); assertEquals("-120", NumberFormats.stringWithoutTrailingZero(String.valueOf(-120))); assertEquals("0", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.0))); assertEquals("0.5", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.5))); assertEquals("0.7", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.70))); assertEquals("0.103", NumberFormats.stringWithoutTrailingZero(String.valueOf(0.1030))); assertEquals("15.05", NumberFormats.stringWithoutTrailingZero(String.valueOf(15.050))); assertEquals(stringContainsDot, NumberFormats.stringWithoutTrailingZero(stringContainsDot)); assertEquals(stringValue, NumberFormats.stringWithoutTrailingZero(stringValue)); }</code><technical_language>please this a parameterized test</technical_language>

Target:
public void testStringWithoutTrailingZero() { assertEquals(stringWithoutTrailingZero, name); }
Source:
<code>public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { <START> addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_KEY, filter, converter, classLoader); <END> }</code><technical_language>DataConversion.IDENTITY_KEY twice</technical_language>

Target:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, DataConversion.IDENTITY_KEY, DataConversion.IDENTITY_VALUE, filter, converter, classLoader); }
Source:
<code>private TypedProperties getOrInitializeTypedProperties() { <START> synchronized (this) { <END> TypedProperties properties = this.properties; if (properties == null) { properties = createTypedProperties(); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return properties; } }</code><technical_language>if youre separating this method +1 nice encapsulation, method is syncronized, change sync block sync method</technical_language>

Target:
private synchronized TypedProperties getOrInitializeTypedProperties() { try { TypedProperties properties = this.properties; if (properties == null) { properties = new TypedProperties(INTERNAL_PROPERTY_NAMES_PREDICATE); if (buffer != null && propertiesLocation >= 0) { final ByteBuf byteBuf = buffer.duplicate().readerIndex(propertiesLocation); properties.decode(byteBuf, coreMessageObjectPools == null ? null : coreMessageObjectPools.getPropertiesDecoderPools()); } this.properties = properties; } return properties; } catch (Throwable e) { throw onCheckPropertiesError(e); } }
Source:
<code><START> public ImmutableSet<IdentifiableBean> search(Search search) { <END> SearchResult searchResult = searchProvider.search(search); Collection<StandardId> matchingIds = searchResult.getMatchingIds(); Collection<IdentifiableBean> beans = sourceProvider.bulkGet(matchingIds).values(); if (beans.size() != matchingIds.size()) { log.warn("Received ids from search provider but source provider only returned of them", matchingIds.size(), beans.size()); } return searchResult.getMatchStatus() == FULL ? ImmutableSet.copyOf(beans) : beans.stream() .filter(search::validateItem) .collect(Guavate.<IdentifiableBean>toImmutableSet()); }</code><technical_language>noting is get a set of beans a more specific type. I suspect a set of IdentifiableBean useful</technical_language>

Target:
public ImmutableSet<IdentifiableBean> search(Search search) { SearchResult searchResult = searchProvider.search(search); Collection<StandardId> matchingIds = searchResult.getMatchingIds(); Collection<IdentifiableBean> beans = sourceProvider.bulkGet(matchingIds).values(); if (beans.size() != matchingIds.size()) { log.warn("Received ids from search provider but source provider only returned of them", matchingIds.size(), beans.size()); } return searchResult.getMatchStatus() == FULL ? ImmutableSet.copyOf(beans) : beans.stream() .filter(search::matches) .collect(Guavate.<IdentifiableBean>toImmutableSet()); }
Source:
<code>public void testHasChangeid() throws Exception { assertEquals( <START> "has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: I0123456789012345678901234567890123456789\n", <END> call("has changeid\n\nBug: 33\nmore text\nSigned-off-by: me@you.too\n\nChange-Id: I0123456789012345678901234567890123456789\n")); }</code><technical_language>this test need change</technical_language>

Target:
public void testHasChangeid() throws Exception { assertEquals( "has changeid\nmore text\n\nBug: 33\nSigned-off-by: me@you.too\n" + "Change-Id: I0123456789012345678901234567890123456789\n", call("has changeid\nmore text\n\nBug: 33\nSigned-off-by: me@you.too\n" + "Change-Id: I0123456789012345678901234567890123456789\n")); }
Source:
<code>public GetObjectResult call() throws Exception { try { if (!force) { BlackPearlUtils.checkBlackPearlForTapeFailure(getClient()); } final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && Utils.fileExists(filePath)) { if (SyncUtils.needToSync(helpers, bucketName, filePath, ds3Obj.getName(), false)) { Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch (final FailedRequestException e) { <START> if (e.getStatusCode() == 500) { <END> LOG.info(e.getMessage()); if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); } else if (e.getStatusCode() == 404) { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: " + e.getMessage(), e); } else { if (LOG.isInfoEnabled()) { e.printStackTrace(); } throw new CommandException("Error: Encountered an unknown error of (" + e.getStatusCode() + ") while accessing the remote DS3 appliance.", e); } } }</code><technical_language>cleaner a switch statement here</technical_language>

Target:
public GetObjectResult call() throws Exception { try { if (!force) { BlackPearlUtils.checkBlackPearlForTapeFailure(getClient()); } final Ds3ClientHelpers helpers = getClientHelpers(); final Path filePath = Paths.get(prefix, objectName); LOG.info("Output path: " + filePath.toString()); final Ds3Object ds3Obj = new Ds3Object(objectName.replace("\\", "/")); if (sync && Utils.fileExists(filePath)) { if (SyncUtils.needToSync(helpers, bucketName, filePath, ds3Obj.getName(), false)) { Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished syncing object."); } else { return new GetObjectResult("SUCCESS: No need to sync " + objectName); } } Transfer(helpers, ds3Obj); return new GetObjectResult("SUCCESS: Finished downloading object. The object was written to: " + filePath); } catch (final FailedRequestException e) { switch (e.getStatusCode()) { case 500: throw new CommandException("Error: Cannot communicate with the remote DS3 appliance.", e); case 404: throw new CommandException("Error: " + e.getMessage(), e); default: throw new CommandException("Error: Encountered an unknown error of (" + e.getStatusCode() + ") while accessing the remote DS3 appliance.", e); } } }
Source:
<code>public <T> CompletableFuture<T> execute(String taskName, TaskContext context) { Cache<?, ?> masterCacheNode = context.getCache().get(); ClusterExecutor clusterExecutor = SecurityActions.getClusterExecutor(context.getCacheManager()); List<T> results = new ArrayList<>(); TriConsumer<Address, T, Throwable> triConsumer = (a, v, t) -> { if (t != null) { throw new CacheException(t); } synchronized (this) { results.add(v); } }; <START> List<TaskParameter> taskParams = context.getParameters().orElse(Collections.emptyMap()).entrySet().stream().map(e -> new TaskParameter(e.getKey(), e.getValue().toString())).collect(Collectors.toList()); <END> CompletableFuture<Void> future = clusterExecutor.submitConsumer(new DistributedServerTask<>(taskName, masterCacheNode.getName(), taskParams), triConsumer); return (CompletableFuture<T>) future.thenApply(ignore -> results); }</code><technical_language>Class variable serverTaskEngine is used, remove constructor</technical_language>

Target:
public <T> CompletableFuture<T> execute(String taskName, TaskContext context) { Cache<?, ?> masterCacheNode = context.getCache().get(); ClusterExecutor clusterExecutor = SecurityActions.getClusterExecutor(context.getCacheManager()); List<T> results = Collections.synchronizedList(new ArrayList<>()); TriConsumer<Address, T, Throwable> triConsumer = (a, v, t) -> { if (t != null) { throw new CacheException(t); } results.add(v); }; List<TaskParameter> taskParams = context.getParameters().orElse(Collections.emptyMap()) .entrySet().stream().map(e -> new TaskParameter(e.getKey(), e.getValue().toString())).collect(Collectors.toList()); CompletableFuture<Void> future = clusterExecutor.submitConsumer( new DistributedServerTask<>(taskName, masterCacheNode.getName(), taskParams), triConsumer ); return (CompletableFuture<T>) future.thenApply(ignore -> results); }
Source:
<code>private void modifyMenu(ActionMode mode) { Menu menu = mode.getMenu(); ArrayList<MenuItem> menuItemsList = new ArrayList<>(); for (int i = 0; i < menu.size(); i++) { <START> String title = menu.getItem(i).getTitle().toString(); <END> if (!title.contains(getString(R.string.menu_text_select_share))) { menuItemsList.add(menu.getItem(i)); } } menu.clear(); mode.getMenuInflater().inflate(R.menu.menu_text_select, menu); for (MenuItem menuItem : menuItemsList) { menu.add(Menu.NONE, menuItem.getItemId(), Menu.NONE, menuItem.getTitle()).setIntent((menuItem.getIntent() == null) ? null : menuItem.getIntent().addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)).setIcon(menuItem.getIcon()); } }</code><technical_language>_do_ want remove "Search Wikipedia" item, in Wikipedia app. reliably check for R.string.search_hint match in languages. (The intention of "Search Wikipedia" item is invoke Wikipedia other apps text is highlighted.)</technical_language>

Target:
private void modifyMenu(ActionMode mode) { Menu menu = mode.getMenu(); ArrayList<MenuItem> menuItemsList = new ArrayList<>(); for (int i = 0; i < menu.size(); i++) { String title = menu.getItem(i).getTitle().toString(); if (!title.contains(getString(R.string.search_hint)) && !title.contains(getString(R.string.menu_text_select_define))) { menuItemsList.add(menu.getItem(i)); } } menu.clear(); mode.getMenuInflater().inflate(R.menu.menu_text_select, menu); for (MenuItem menuItem : menuItemsList) { menu.add(menuItem.getGroupId(), menuItem.getItemId(), Menu.NONE, menuItem.getTitle()).setIntent(menuItem.getIntent()).setIcon(menuItem.getIcon()); } }
Source:
<code>public static void methodInvoke(Method method, Object target) throws InvocationTargetException, IllegalAccessException { MethodHandle handler = methodHandlesMap.get(method); if (handler != null) { try { if (Modifier.isStatic(method.getModifiers())) { <START> log.warn("static lifecycle method: " + method + ", target=" + target); <END> handler.invoke(); } else { handler.invoke(target); } } catch (Throwable e) { throw new InvocationTargetException(e, "invokedynamic: method=" + method + ", target=" + target); } } else { method.invoke(target); } }</code><technical_language>nit: for parameter replacements java log.warn("Invalid of @PostConstruct static method={}, target={}", method, target);</technical_language>

Target:
public static void methodInvoke(Method method, Object target) throws InvocationTargetException, IllegalAccessException { MethodHandle handler = methodHandlesMap.get(method); if (handler != null) { try { if (Modifier.isStatic(method.getModifiers())) { log.warn("static lifecycle method: {}, target={}", method, target); handler.invoke(); } else { handler.invoke(target); } } catch (Throwable e) { throw new InvocationTargetException(e, "invokedynamic: method=" + method + ", target=" + target); } } else { method.invoke(target); } }
Source:
<code>public Optional<ReadMapping> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle) { <START> if (typeHandle.getJdbcType() == microsoft.sql.Types.DATETIMEOFFSET) { <END> return Optional.of(dateTimeOffsetReadMapping()); } return super.toPrestoType(session, typeHandle); }</code><technical_language>Static import DATETIMEOFFSET</technical_language>

Target:
public Optional<ReadMapping> toPrestoType(ConnectorSession session, JdbcTypeHandle typeHandle) { if (typeHandle.getJdbcType() == DATETIMEOFFSET) { return Optional.of(dateTimeOffsetReadMapping()); } return super.toPrestoType(session, typeHandle); }
Source:
<code>protected void addChangeRecord(ChangeRecord c) { <START> LOG.info("addChangeRecord called"); <END> synchronized (zks.getOutstandingChanges()) { zks.getOutstandingChanges().add(c); zks.getOutstandingChangesForPath().put(c.path, c); ServerMetrics.OUTSTANDING_CHANGES_QUEUED.add(1); } }</code><technical_language>Is this a debug drop</technical_language>

Target:
protected void addChangeRecord(ChangeRecord c) { synchronized (zks.outstandingChanges) { zks.outstandingChanges.add(c); zks.outstandingChangesForPath.put(c.path, c); ServerMetrics.getMetrics().OUTSTANDING_CHANGES_QUEUED.add(1); } }
Source:
<code>protected void doInit() { super.doInit(); RSocketRequester.Builder builder = RSocketRequester.builder(); <START> if (this.factoryConfigurer != null) { <END> builder.rsocketFactory(this.factoryConfigurer); } if (this.strategiesConfigurer != null) { builder.rsocketStrategies(this.strategiesConfigurer); } this.rSocketRequesterMono = builder.connect(this.clientTransport, this.dataMimeType); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }</code><technical_language>cleaner default a no-op configurers assert null in setters</technical_language>

Target:
protected void doInit() { super.doInit(); this.rSocketRequesterMono = RSocketRequester.builder() .rsocketFactory(this.factoryConfigurer) .rsocketStrategies(this.strategiesConfigurer) .connect(this.clientTransport, this.dataMimeType); this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory()); }
Source:
<code>public short sizeInBytes() { short sizeForBlobIdV1 = (short) (VERSION_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + uuid.getBytes().length); switch (version) { case BLOB_ID_V1: return sizeForBlobIdV1; case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: return (short) (FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + sizeForBlobIdV1); case BLOB_ID_V6: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length <START> + 16); <END> default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } }</code><technical_language>2 * Long.BYTES</technical_language>

Target:
public short sizeInBytes() { switch (version) { case BLOB_ID_V1: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + getUuid().getBytes().length); case BLOB_ID_V2: case BLOB_ID_V3: case BLOB_ID_V4: case BLOB_ID_V5: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UUID_SIZE_FIELD_LENGTH_IN_BYTES + getUuid().getBytes().length); case BLOB_ID_V6: return (short) (VERSION_FIELD_LENGTH_IN_BYTES + FLAG_FIELD_LENGTH_IN_BYTES + DATACENTER_ID_FIELD_LENGTH_IN_BYTES + ACCOUNT_ID_FIELD_LENGTH_IN_BYTES + CONTAINER_ID_FIELD_LENGTH_IN_BYTES + partitionId.getBytes().length + UuidSerDe.SIZE_IN_BYTES); default: throw new IllegalArgumentException("blobId version=" + version + " not supported"); } }
Source:
<code>public void factoryReset() { enforceConnectivityInternalPermission(); mLog.trace("factoryReset uid=%").c(Binder.getCallingUid()).flush(); if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { return; } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { setWifiApEnabled(null, false); } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI)) { try { setWifiEnabled(mContext.getOpPackageName(), true); } catch (RemoteException e) { } ParceledListSlice<WifiConfiguration> parceledList = <START> getConfiguredNetworks(); <END> if (parceledList != null) { List<WifiConfiguration> networks = parceledList.getList(); if (networks != null) { for (WifiConfiguration config : networks) { removeNetwork(config.networkId); } saveConfiguration(); } } } }</code><technical_language>is a need convert |ParcelListSize| |List| here. invoke wifi state machine method fetch list necessary permission checks performed above. if (mWifiStateMachineChannel != null) { List<WifiConfiguration> configs = mWifiStateMachine.syncGetConfiguredNetworks( Binder.getCallingUid(), mWifiStateMachineChannel);</technical_language>

Target:
public void factoryReset() { enforceConnectivityInternalPermission(); mLog.trace("factoryReset uid=%").c(Binder.getCallingUid()).flush(); if (mUserManager.hasUserRestriction(UserManager.DISALLOW_NETWORK_RESET)) { return; } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) { setWifiApEnabled(null, false); } if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_WIFI)) { try { setWifiEnabled(mContext.getOpPackageName(), true); } catch (RemoteException e) { } List<WifiConfiguration> networks = mWifiStateMachine.syncGetConfiguredNetworks( Binder.getCallingUid(), mWifiStateMachineChannel); if (networks != null) { for (WifiConfiguration config : networks) { removeNetwork(config.networkId); } saveConfiguration(); } } }
Source:
<code>public void updateAllInBatch(Collection<T> entities) { <START> if (entities != null && entities.size() > 0) <END> updateAllInBatch(getProcedureNameForUpdate(), entities, getBatchMapper()); }</code><technical_language>{ for line in scope. lets consider a report if null is passed</technical_language>

Target:
public void updateAllInBatch(Collection<T> entities) { if (entities != null && entities.size() > 0) { updateAllInBatch(getProcedureNameForUpdate(), entities, getBatchMapper()); } }
Source:
<code>private static URIBuilder getServiceUri(Project project, String baseUrl) { String urlString = project == null ? baseUrl : getServerUrl(project); if (urlString == null) { return null; } URIBuilder uri; try { uri = new URIBuilder(urlString); } catch (URISyntaxException e) { Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); return null; } String currentPath = Optional.ofNullable(uri.getPath()).orElse(""); <START> uri.setPath(currentPath + (currentPath.endsWith("/") ? "" : "/") + "alfresco/service"); <END> if (project != null && TicketUtils.isTicketSet(project)) { uri.setParameter("alf_ticket", TicketUtils.getTicket(project)); } return uri; }</code><technical_language>making a logic error. this handle properly case user "alfresco/service" in path. strip modify if is case</technical_language>

Target:
private static URIBuilder getServiceUri(Project project, String baseUrl) { String urlString = project == null ? baseUrl : getServerUrl(project); if (urlString == null) { return null; } URIBuilder uri; try { uri = new URIBuilder(urlString); } catch (URISyntaxException e) { Application.getInstance().getGUILog().log("[ERROR] Unexpected error in generation of MMS URL for project. Reason: " + e.getMessage()); e.printStackTrace(); return null; } String path = Optional.ofNullable(uri.getPath()).orElse(""); if (path.endsWith("/")) { path = path.substring(0, path.length() - 1); } if (!path.endsWith("alfresco/service")) { path += "/alfresco/service"; } uri.setPath(path); if (project != null && TicketUtils.isTicketSet(project)) { uri.setParameter("alf_ticket", TicketUtils.getTicket(project)); } return uri; }
Source:
<code>void addVolume(FsVolumeImpl volume) { String mount = volume.getMount(); if (!mount.isEmpty()) { Map<StorageType, VolumeInfo> storageTypeMap = mountVolumeMapping .getOrDefault(mount, new ConcurrentHashMap<>()); if (storageTypeMap.containsKey(volume.getStorageType())) { FsDatasetImpl.LOG.error("Found storage type already exist." + " Skipping for now. Please check disk configuration"); } else { VolumeInfo volumeInfo = new VolumeInfo(volume, 1); if (volume.getStorageType() == StorageType.ARCHIVE) { volumeInfo.setCapacityRatio(reservedForArchive); } else if (volume.getStorageType() == StorageType.DISK) { <START> volumeInfo.setCapacityRatio(1 - reservedForArchive); <END> } storageTypeMap.put(volume.getStorageType(), volumeInfo); mountVolumeMapping.put(mount, storageTypeMap); } } }</code><technical_language>if a mount single volume? current implementation assign unnecessary capacity ratio it. need calculate assign ratio for volumes sharing mount others</technical_language>

Target:
void addVolume(FsVolumeImpl volume) { String mount = volume.getMount(); if (!mount.isEmpty()) { MountVolumeInfo info; if (mountVolumeMapping.containsKey(mount)) { info = mountVolumeMapping.get(mount); } else { info = new MountVolumeInfo(conf); mountVolumeMapping.put(mount, info); } info.addVolume(volume); } }
Source:
<code>private void bindView(ServerFile file, View view) { ImageView fileIconView = (ImageView) view.findViewById(R.id.icon); TextView fileTextView = (TextView) view.findViewById(R.id.text); TextView fileSize = (TextView) view.findViewById(R.id.file_size); TextView fileLastModified = (TextView) view.findViewById(R.id.last_modified); LinearLayout moreInfo = (LinearLayout) view.findViewById(R.id.more_info); fileTextView.setText(getFileName(file)); int size=getFileSize(file); if(size==0){ moreInfo.setVisibility(View.GONE); }else{ moreInfo.setVisibility(View.VISIBLE); double inMb=(size/1024.0)/1024.0; <START> fileSize.setText(((int)(inMb*100))/100.0+"MB"); <END> Date d=getLastModified(file); SimpleDateFormat dt = new SimpleDateFormat("EEE LLL dd yyyy"); fileLastModified.setText(dt.format(d)); } if (Mimes.match(file.getMime()) == Mimes.Type.IMAGE) { setUpImageIcon(file, fileIconView); } else { fileIconView.setImageResource(getFileIcon(file)); } }</code><technical_language>This is a bad of conversion. java's String.format() function return decimal places</technical_language>

Target:
private void bindView(ServerFile file, View view) { ImageView fileIconView = (ImageView) view.findViewById(R.id.icon); TextView fileTextView = (TextView) view.findViewById(R.id.text); TextView fileSize = (TextView) view.findViewById(R.id.file_size); TextView fileLastModified = (TextView) view.findViewById(R.id.last_modified); LinearLayout moreInfo = (LinearLayout) view.findViewById(R.id.more_info); fileTextView.setText(getFileName(file)); long size=getFileSize(file); if(file.getMime().equals("text/directory")){ moreInfo.setVisibility(View.GONE); }else{ moreInfo.setVisibility(View.VISIBLE); fileSize.setText(Formatter.formatFileSize(context, size)); Date d=getLastModified(file); SimpleDateFormat dt = new SimpleDateFormat("EEE LLL dd yyyy"); fileLastModified.setText(dt.format(d)); } if (Mimes.match(file.getMime()) == Mimes.Type.IMAGE) { setUpImageIcon(file, fileIconView); } else { fileIconView.setImageResource(getFileIcon(file)); } }
Source:
<code>public void insertHeaderWithTimestampValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); <START> props.put("literal.value", "2019-08-23T14\\:34\\:54.346Z"); <END> xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Timestamp.SCHEMA, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2019-08-23T14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }</code><technical_language>question escaping colon character</technical_language>

Target:
public void insertHeaderWithTimestampValue() throws ParseException { final Map<String, Object> props = new HashMap<>(); props.put("header", "AAA"); props.put("literal.value", "2019-08-23T14:34:54.346Z"); xform.configure(props); final SourceRecord record = new SourceRecord(null, null, "test", 0, null, null, null, null, null, null); final SourceRecord transformedRecord = xform.apply(record); SchemaAndValue schemaAndValue = new SchemaAndValue(Timestamp.SCHEMA, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2019-08-23T14:34:54.346Z")); Headers expected = new ConnectHeaders().add("AAA", schemaAndValue); assertEquals(1, transformedRecord.headers().size()); assertEquals(expected, transformedRecord.headers()); }
Source:
<code>public void onResume() { Log.i(LOG_TAG, "Called SetupSyncActivity.onResume."); super.onResume(); if (!hasInternet()) { setContentView(R.layout.sync_setup_nointernet); return; } Account[] accts = mAccountManager.getAccountsByType(Constants.ACCOUNTTYPE_SYNC); if (accts.length == 0) { Log.d(LOG_TAG, "No accounts; starting J-PAKE receiver."); displayReceiveNoPin(); if (jClient != null) { <START> jClient.finished = true; <END> } jClient = new JPakeClient(this); jClient.receiveNoPin(); return; } Bundle extras = this.getIntent().getExtras(); if (extras != null) { Log.d(LOG_TAG, "SetupSync with extras."); boolean isSetup = extras.getBoolean(Constants.INTENT_EXTRA_IS_SETUP); if (!isSetup) { Log.d(LOG_TAG, "Account exists; Pair a Device started."); pairWithPin = true; displayPairWithPin(); return; } } Log.d(LOG_TAG, "Only one account supported. Redirecting."); Toast toast = Toast.makeText(mContext, R.string.sync_notification_oneaccount, Toast.LENGTH_LONG); toast.show(); Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS); intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); startActivity(intent); finish(); }</code><technical_language>this free resources? need abort summat? :D</technical_language>

Target:
public void onResume() { Logger.info(LOG_TAG, "Called SetupSyncActivity.onResume."); super.onResume(); if (!hasInternet()) { setContentView(R.layout.sync_setup_nointernet); return; } Account[] accts = mAccountManager.getAccountsByType(Constants.ACCOUNTTYPE_SYNC); if (accts.length == 0) { Logger.debug(LOG_TAG, "No accounts; starting J-PAKE receiver."); displayReceiveNoPin(); if (jClient != null) { jClient.finished = true; } jClient = new JPakeClient(this); jClient.receiveNoPin(); return; } Bundle extras = this.getIntent().getExtras(); if (extras != null) { Logger.debug(LOG_TAG, "SetupSync with extras."); boolean isSetup = extras.getBoolean(Constants.INTENT_EXTRA_IS_SETUP); if (!isSetup) { Logger.debug(LOG_TAG, "Account exists; Pair a Device started."); pairWithPin = true; displayPairWithPin(); return; } } Logger.debug(LOG_TAG, "Only one account supported. Redirecting."); Toast toast = Toast.makeText(mContext, R.string.sync_notification_oneaccount, Toast.LENGTH_LONG); toast.show(); Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS); intent.setFlags(Constants.FLAG_ACTIVITY_REORDER_TO_FRONT_NO_ANIMATION); startActivity(intent); finish(); }
Source:
<code>private Integer getMetadataSizeLimit() { <START> String sizeLimit = System.getProperty("metadata.size.limit"); <END> if (StringUtils.isNumeric(sizeLimit)) { if (Integer.parseInt(sizeLimit) * 1000000 < Integer.MAX_VALUE) { METADATA_MAXIMUM_BYTES = Integer.parseInt(sizeLimit) * 1000000; return METADATA_MAXIMUM_BYTES; } } METADATA_MAXIMUM_BYTES = 5000000; return METADATA_MAXIMUM_BYTES; }</code><technical_language>extend privileges read this property</technical_language>

Target:
static Integer getMetadataSizeLimit() { String sizeLimit = AccessController.doPrivileged( (PrivilegedAction<String>) () -> System.getProperty(METADATA_SIZE_LIMIT, String.valueOf(FIVE_MEGABYTES))); if (StringUtils.isNumeric(sizeLimit)) { try { return Integer.parseInt(sizeLimit); } catch (NumberFormatException e) { LOGGER.info("Metadata size limit set in system properties is out of range: {}", sizeLimit); } } else { LOGGER.info("User set metadata size limit is not numeric: {}", sizeLimit); } return FIVE_MEGABYTES; }
Source:
<code>public Optional<Long> getTotalEstimatedTime() { <START> boolean isAnyActionEstimated = false; Long total = 0L; for (ScriptGeneratorAction action : actions) { if (action.getEstimatedTime().isPresent()) { isAnyActionEstimated = true; total += action.getEstimatedTime().get().longValue(); } } return isAnyActionEstimated ? Optional.of(total) : Optional.empty(); <END> }</code><technical_language>replace streams: suggestion Stream<Number> actualEstimates = actions.stream().map(action -> action.getEstimatedTime()).flatMap(Optional::stream); Long total = actualEstimates.map(x -> x.longValue()).reduce(0L, Long::sum); return actualEstimates.count() == 0? Optional.empty() : Optional.of(total); streams if more readable</technical_language>

Target:
public Optional<Long> getTotalEstimatedTime() { List<Number> actualEstimates = actions.stream().map(action -> action.getEstimatedTime()).flatMap(Optional::stream).collect(Collectors.toList()); Long total = actualEstimates.stream().map(x -> x.longValue()).reduce(0L, Long::sum); return actualEstimates.size() == 0 ? Optional.empty() : Optional.of(total); }
Source:
<code>public void testSpawnFragmentSameTraceId() { DefaultTraceCollector collector = new DefaultTraceCollector(); FragmentBuilder parent = new FragmentBuilder(); FragmentBuilder spawned = new FragmentBuilder(); <START> Trace parentBTxn = parent.getTrace(); <END> Trace spawnedBTxn = spawned.getTrace(); parentBTxn.setTraceId(TRACE_ID); Consumer parentConsumer = new Consumer(); collector.push(null, parent, parentConsumer); collector.spawnFragment(parent, parentConsumer, -1, spawned); assertEquals(TRACE_ID, spawnedBTxn.getTraceId()); }</code><technical_language>BTxn suffix? parentTrace more intuitive</technical_language>

Target:
public void testSpawnFragmentSameTraceId() { DefaultTraceCollector collector = new DefaultTraceCollector(); FragmentBuilder parent = new FragmentBuilder(); FragmentBuilder spawned = new FragmentBuilder(); Trace parentTrace = parent.getTrace(); Trace spawnedTrace = spawned.getTrace(); parentTrace.setTraceId(TRACE_ID); Consumer parentConsumer = new Consumer(); collector.push(null, parent, parentConsumer); collector.spawnFragment(parent, parentConsumer, -1, spawned); assertEquals(TRACE_ID, spawnedTrace.getTraceId()); }
Source:
<code>public CalcSubscription build() { return new CalcSubscription(amount, discountAmount, discountPercent, endTime, period, price, resource <START> , startTime); <END> }</code><technical_language>Formatting: move , end of previous line</technical_language>

Target:
public CalcSubscription build() { return new CalcSubscription(amount, discountAmount, discountPercent, period, price, resource, startTime, endTime); }
Source:
<code>public Mono<String> getBodyAsString() { <START> return getBodyAsByteArray().map(bytes -> { <END> if (bytes.length >= 3 && bytes[0] == (byte) 239 && bytes[1] == (byte) 187 && bytes[2] == (byte) 191) { return new String(bytes, 3, bytes.length - 3, StandardCharsets.UTF_8); } else if (bytes.length >= 2 && bytes[0] == (byte) 254 && bytes[1] == (byte) 255) { return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16BE); } else if (bytes.length >= 2 && bytes[0] == (byte) 255 && bytes[1] == (byte) 254) { return new String(bytes, 2, bytes.length - 2, StandardCharsets.UTF_16LE); } else { try { String contentType = reactorNettyResponse.responseHeaders() .get("Content-Type", "charset=UTF-8"); Matcher charsetMatcher = CHARSET_PATTERN.matcher(contentType); if (charsetMatcher.find()) { return new String(bytes, Charset.forName(charsetMatcher.group(1))); } else { return new String(bytes, StandardCharsets.UTF_8); } } catch (IllegalCharsetNameException | UnsupportedCharsetException ex) { return new String(bytes, StandardCharsets.UTF_8); } } }); }</code><technical_language>JDK client Netty client do logic for converting response byte array string. put this in Core utils reduce duplication if fixes updates this logic, need update in places</technical_language>

Target:
public Mono<String> getBodyAsString() { return getBodyAsByteArray().map(bytes -> CoreUtils.bomAwareToString(bytes, reactorNettyResponse.responseHeaders().get("Content-Type"))); }
Source:
<code>public InputStream read(IFile target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); if (lightweightAutoRefreshEnabled || !force) { final IFileInfo fileInfo = store.fetchInfo(); if (!fileInfo.exists()) { asyncRefresh(target); String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, null); } ResourceInfo info = ((Resource) target).getResourceInfo(true, false); int flags = ((Resource) target).getFlags(info); ((Resource) target).checkExists(flags, true); if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { asyncRefresh(target); if (!force) { String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null); } } } try { return store.openInputStream(EFS.NONE, monitor); } catch (CoreException e) { if (e.getStatus().getCode() == EFS.ERROR_NOT_EXISTS) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, <START> null); <END> } throw e; } }</code><technical_language>do propagate original exception cause</technical_language>

Target:
public InputStream read(IFile target, boolean force, IProgressMonitor monitor) throws CoreException { IFileStore store = getStore(target); if (lightweightAutoRefreshEnabled || !force) { final IFileInfo fileInfo = store.fetchInfo(); if (!fileInfo.exists()) { asyncRefresh(target); String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, null); } ResourceInfo info = ((Resource) target).getResourceInfo(true, false); int flags = ((Resource) target).getFlags(info); ((Resource) target).checkExists(flags, true); if (fileInfo.getLastModified() != info.getLocalSyncInfo()) { asyncRefresh(target); if (!force) { String message = NLS.bind(Messages.localstore_resourceIsOutOfSync, target.getFullPath()); throw new ResourceException(IResourceStatus.OUT_OF_SYNC_LOCAL, target.getFullPath(), message, null); } } } try { return store.openInputStream(EFS.NONE, monitor); } catch (CoreException e) { if (e.getStatus().getCode() == EFS.ERROR_NOT_EXISTS) { String message = NLS.bind(Messages.localstore_fileNotFound, store.toString()); throw new ResourceException(IResourceStatus.RESOURCE_NOT_FOUND, target.getFullPath(), message, e); } throw e; } }
Source:
<code>public void close() { if (file.exists() && getCompactionState().equals(State.DONE)) { <START> File savedLog = new File(file.getAbsolutePath() + "_" + startTime); <END> if (!file.renameTo(savedLog)) { throw new IllegalStateException("Compaction log could not be renamed after completion of compaction"); } } }</code><technical_language>add a human readable time(Date time stamp) time in millis</technical_language>

Target:
public void close() { if (file.exists() && getCompactionPhase().equals(Phase.DONE)) { String dateString = new Date(startTime).toString(); File savedLog = new File(file.getAbsolutePath() + BlobStore.SEPARATOR + startTime + BlobStore.SEPARATOR + dateString); if (!file.renameTo(savedLog)) { throw new IllegalStateException("Compaction log could not be renamed after completion of compaction"); } } }
Source:
<code>public static void deleteAll(Context c) { try { <START> FileUtils.cleanDirectory(Measurement.createMeasurementDir(c)); <END> } catch (Exception e) { e.printStackTrace(); } Delete.tables(Measurement.class, Result.class); }</code><technical_language>I realise in places in this is called. I in situations sense for called this way, I suggest do I originally suggested split creation of directory pathname</technical_language>

Target:
public static void deleteAll(Context c) { try { FileUtils.cleanDirectory(Measurement.getMeasurementDir(c)); } catch (Exception e) { e.printStackTrace(); } Delete.tables(Measurement.class, Result.class); }
Source:
<code>private HashSet<Object> getCheckedProjects() { HashSet<Object> ret = new HashSet<Object>(); <START> for (TreeItem item : projectsList.getTree().getItems()) { <END> if (item.getChecked()) { ret.add(item.getData()); } } return ret; }</code><technical_language>for single lines, do want brackets</technical_language>

Target:
private HashSet<Object> getCheckedProjects() { HashSet<Object> ret = new HashSet<Object>(); for (TreeItem item : projectsList.getTree().getItems()) if (item.getChecked()) ret.add(item.getData()); return ret; }