auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testP2PStateTransitionEnabled() { enableP2PInCluster(CLUSTER_NAME, _configAccessor, true); long startTime = System.currentTimeMillis(); MockHelixTaskExecutor.resetStats(); for (String ins : _instances) { _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, false); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, true); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); } double ratio = ((double) p2pTrigged) / ((double) total); <START> Assert.assertTrue(ratio == 1, String <END> .format("Only %d out of %d percent transitions to Master were triggered by expected host!", p2pTrigged, total)); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessagesInProgress, 0, "There are duplicated transition messages sent while participant is handling the state-transition!"); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessages, 0, "There are duplicated transition messages sent at same time!"); }</code><technical_language>nit, Assert.assertEquals(p2pTrigged, total) now</technical_language>

Target:
public void testP2PStateTransitionEnabled() { enableP2PInCluster(CLUSTER_NAME, _configAccessor, true); long startTime = System.currentTimeMillis(); MockHelixTaskExecutor.resetStats(); for (String ins : _instances) { _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, false); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); _gSetupTool.getClusterManagementTool().enableInstance(CLUSTER_NAME, ins, true); Assert.assertTrue(_clusterVerifier.verifyByPolling()); verifyP2PEnabled(startTime); } Assert.assertEquals(p2pTrigged, total); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessagesInProgress, 0, "There are duplicated transition messages sent while participant is handling the state-transition!"); Assert.assertEquals(MockHelixTaskExecutor.duplicatedMessages, 0, "There are duplicated transition messages sent at same time!"); }
Source:
<code>public void testSetProperties() throws Exception { CrateConnection conn = new CrateConnection(clientHandle()); conn.connect(); Properties properties = new Properties(); properties.setProperty("prop1", "value1"); properties.setProperty("prop2", "value2"); conn.setClientInfo(properties); assertThat(conn.getClientInfo().size(), is(2)); conn.setClientInfo(new Properties()); assertThat(conn.getClientInfo().size(), is(0)); conn.setClientInfo("prop1", "value1"); conn.setClientInfo("prop2", "value2"); conn.setClientInfo("prop1", null); assertThat(conn.getClientInfo().size(), is(1)); conn.close(); <START> try { <END> conn.setClientInfo(properties); fail("This line should not be reached. The connection must be open to set properties"); } catch (Throwable e) { assertEquals(e.getClass(), SQLClientInfoException.class); } }</code><technical_language>I put test case a separate test method. expectedException</technical_language>

Target:
public void testSetProperties() throws Exception { CrateConnection conn = new CrateConnection(clientHandle()); conn.connect(); Properties properties = new Properties(); properties.setProperty("prop1", "value1"); properties.setProperty("prop2", "value2"); conn.setClientInfo(properties); assertThat(conn.getClientInfo().size(), is(2)); conn.setClientInfo(new Properties()); assertThat(conn.getClientInfo().size(), is(0)); conn.setClientInfo("prop1", "value1"); conn.setClientInfo("prop2", "value2"); conn.setClientInfo("prop1", null); assertThat(conn.getClientInfo().size(), is(1)); conn.close(); }
Source:
<code>public void clickOnVideoCloseButton() { <START> scrollToAdsElement(videoCloseButton(slotName), 60); <END> videoCloseButton(slotName).click(); PageObjectLogging.log("clickOnVideoCloseButton", "close video button clicked", true, driver); }</code><technical_language>60pixels is offset here? is height of element</technical_language>

Target:
public void clickOnVideoCloseButton() { scrollToAdVideo(getVideoCloseButton(slotName)); getVideoCloseButton(slotName).click(); PageObjectLogging.log("clickOnVideoCloseButton", "close video button clicked", true, driver); }
Source:
<code>void on(@Where(field = "head.value", equals = "42") <START> Organization organization) { <END> fail(FilteredStateSubscriberWhere.class.getSimpleName() + " should not be able to receive any updates."); }</code><technical_language>Please fix code alignment</technical_language>

Target:
void on( @Where(field = "head.value", equals = "42") Organization organization) { halt(); }
Source:
<code>public int hashCode() { <START> return layout.hashCode(); <END> }</code><technical_language>items label</technical_language>

Target:
public int hashCode() { int result = super.hashCode(); result = 31 * result + (layout != null ? layout.hashCode() : 0); return result; }
Source:
<code>public String update(Request request, Response response)throws IOException { String configId = request.params(CONFIG_ID_PARAM); SecretConfig oldSecretConfig = fetchEntityFromConfig(configId); SecretConfig newSecretConfig = buildEntityFromRequestBody(request); if (isRenameAttempt(oldSecretConfig.getId(), newSecretConfig.getId())) { throw haltBecauseRenameOfEntityIsNotSupported(getEntityType().getEntityNameLowerCase()); } if (isPutRequestStale(request, oldSecretConfig)) { throw haltBecauseEtagDoesNotMatch(); } <START> final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); <END> configService.update(currentUsername(), etagFor(newSecretConfig), newSecretConfig, operationResult); return handleCreateOrUpdateResponse(request, response, fetchEntityFromConfig(configId), operationResult); }</code><technical_language>Update call secret config id in payload. IMO if is return 422 error</technical_language>

Target:
public String update(Request request, Response response) { String configId = request.params(CONFIG_ID_PARAM); SecretConfig oldSecretConfig = fetchEntityFromConfig(configId); SecretConfig newSecretConfig = buildEntityFromRequestBody(request); if (isRenameAttempt(oldSecretConfig.getId(), newSecretConfig.getId())) { throw haltBecauseRenameOfEntityIsNotSupported(getEntityType().getEntityNameLowerCase()); } if (isPutRequestStale(request, oldSecretConfig)) { throw haltBecauseEtagDoesNotMatch(); } final HttpLocalizedOperationResult operationResult = new HttpLocalizedOperationResult(); configService.update(currentUsername(), etagFor(newSecretConfig), newSecretConfig, operationResult); return handleCreateOrUpdateResponse(request, response, fetchEntityFromConfig(configId), operationResult); }
Source:
<code>public SamzaSqlRelMessage convertToRelMessage(KV<Object, Object> samzaMessage) { List<String> payloadFieldNames = new ArrayList<>(); List<Object> payloadFieldValues = new ArrayList<>(); Object value = samzaMessage.getValue(); if (value instanceof IndexedRecord) { fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) value, payloadFieldNames, payloadFieldValues, payloadSchema); } else if (value == null) { payloadFieldNames.addAll(payloadSchema.getFields().stream().map(Schema.Field::name).collect(Collectors.toList())); IntStream.range(0, payloadFieldNames.size()).forEach(x -> payloadFieldValues.add(null)); } else { String msg = "Avro message converter doesn't support messages of type " + value.getClass(); LOG.error(msg); throw new SamzaException(msg); } Object key = samzaMessage.getKey(); <START> if (key instanceof IndexedRecord) { <END> Validate.isTrue(keySchema != null, "key is an IndexedRecord but could not obtain schema."); List<String> keyFieldNames = new ArrayList<>(); List<Object> keyFieldValues = new ArrayList<>(); fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) key, keyFieldNames, keyFieldValues, keySchema); key = new SamzaSqlRelRecord(keyFieldNames, keyFieldValues); } return new SamzaSqlRelMessage(key, payloadFieldNames, payloadFieldValues); }</code><technical_language>fact a key Avro RelMessageConverter. I need this if else in this layer,Rather cleaner if move this a layer AvroRelMessageConverter BrooklinRelMessageConverter KafkaRelMessageConverter. is ok if this layer handles keys of type String long is a clean override behavior</technical_language>

Target:
public SamzaSqlRelMessage convertToRelMessage(KV<Object, Object> samzaMessage) { List<String> payloadFieldNames = new ArrayList<>(); List<Object> payloadFieldValues = new ArrayList<>(); Object value = samzaMessage.getValue(); if (value instanceof IndexedRecord) { fetchFieldNamesAndValuesFromIndexedRecord((IndexedRecord) value, payloadFieldNames, payloadFieldValues, payloadSchema); } else if (value == null) { payloadFieldNames.addAll(payloadSchema.getFields().stream().map(Schema.Field::name).collect(Collectors.toList())); IntStream.range(0, payloadFieldNames.size()).forEach(x -> payloadFieldValues.add(null)); } else { String msg = "Avro message converter doesn't support messages of type " + value.getClass(); LOG.error(msg); throw new SamzaException(msg); } return new SamzaSqlRelMessage(samzaMessage.getKey(), payloadFieldNames, payloadFieldValues); }
Source:
<code>public Vector<T> prependAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); if (!elements.iterator().hasNext()) { return this; } else if (isEmpty()) { return ofAll(elements); } else { Vector<T> result = this; <START> for (T element : seq(elements).reverse()) { <END> result = result.prepend(element); } return result; } }</code><technical_language>This is more obvious code, thank</technical_language>

Target:
public Vector<T> prependAll(Iterable<? extends T> elements) { Objects.requireNonNull(elements, "elements is null"); if (isEmpty()) { return ofAll(elements); } else { Vector<T> result = this; for (T element : seq(elements).reverse()) { result = result.prepend(element); } return result.isEmpty() ? empty() : result; } }
Source:
<code>public void testJoin() throws Exception { Multimap<User, Article> joined = HashMultimap.create(); h.createQuery("SELECT * FROM user NATURAL JOIN author NATURAL JOIN article") .map(JoinRowMapper.forTypes(User.class, Article.class)) <START> .forEach(jr -> joined.put(jr.get(User.class), jr.get(Article.class))); <END> Multimap<User, Article> expected = HashMultimap.create(); expected.put(u(1), a(2)); expected.put(u(3), a(1)); expected.put(u(3), a(3)); assertThat(joined, is(expected)); }</code><technical_language>Multimap is pretty greatest</technical_language>

Target:
public void testJoin() throws Exception { Multimap<User, Article> joined = HashMultimap.create(); h.createQuery("SELECT * FROM user NATURAL JOIN author NATURAL JOIN article") .map(JoinRowMapper.forTypes(User.class, Article.class)) .forEach(jr -> joined.put(jr.get(User.class), jr.get(Article.class))); assertThat(joined, is(getExpected())); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mediaFiles == null) ? 0 : mediaFiles.hashCode()); result = prime * result + order; result = prime * result + ((orderlabel == null) ? 0 : orderlabel.hashCode()); <START> result = prime * result + ((type == null) ? 0 : type.hashCode()); <END> return result; }</code><technical_language>decided Objects.isNull</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((mediaFiles == null) ? 0 : mediaFiles.hashCode()); result = prime * result + order; result = prime * result + ((orderlabel == null) ? 0 : orderlabel.hashCode()); result = prime * result + (Objects.isNull(type) ? 0 : type.hashCode()); return result; }
Source:
<code>CompletableFuture<Void> closeAsync(Throwable cause) { if (!isReleasing()) { state = TaskSlotState.RELEASING; if (!isEmpty()) { tasks.values().forEach(task -> task.failExternally(cause)); } <START> final CompletableFuture<Void> cleanupFuture = FutureUtils <END> .waitForAll(tasks.values().stream().map(TaskSlotPayload::getTerminationFuture).collect(Collectors.toList())) .thenRun(memoryManager::shutdown); verifyAllManagedMemoryIsReleasedAfter(cleanupFuture); FutureUtils.forward(cleanupFuture, closingFuture); } return closingFuture; }</code><technical_language>rename this shutdownFuture? cleanup successful</technical_language>

Target:
CompletableFuture<Void> closeAsync(Throwable cause) { if (!isReleasing()) { state = TaskSlotState.RELEASING; if (!isEmpty()) { tasks.values().forEach(task -> task.failExternally(cause)); } final CompletableFuture<Void> shutdownFuture = FutureUtils .waitForAll(tasks.values().stream().map(TaskSlotPayload::getTerminationFuture).collect(Collectors.toList())) .thenRun(memoryManager::shutdown); verifyAllManagedMemoryIsReleasedAfter(shutdownFuture); FutureUtils.forward(shutdownFuture, closingFuture); } return closingFuture; }
Source:
<code>private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); cal.add(Calendar.MINUTE, (-1) * cmdEntity.getCommandParameters().getLifeInMinutes()); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { <START> coco.updateCommandStatus(cmdId, CommandStatus.FAILED); <END> } } }</code><technical_language>missing indication command failed of a timeout. 1. for logging/auditing 2. able react differently if command failed of a timeout (maybe in this case want retrigger in future opposed command failed of permissions)</technical_language>

Target:
private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); Integer cmdLifeTimeInMin = cmdEntity.getCommandParameters().getLifeInMinutes(); cal.add(Calendar.MINUTE, (-1) * (cmdLifeTimeInMin == null ? Config.<Integer>getValue(ConfigValues.CoCoLifeInMinutes) : cmdLifeTimeInMin)); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { log.info("Marking expired command as Failed: command '{}({})' that started at '{}' has been marked as Failed.", cmdEntity.getCommandParameters().getCommandType(), cmdEntity.getCommandParameters().getCommandId(), cmdEntity.getCreatedAt()); coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } } }
Source:
<code>public void testReconnectModeASYNCTwoMembers() { hazelcastFactory.newInstances(getConfig(), 2); CountDownLatch connectedLatch = new CountDownLatch(1); ClientConfig clientConfig = new ClientConfig(); clientConfig.addListenerConfig(new ListenerConfig((LifecycleListener) event -> { if (event.getState().equals(CLIENT_CONNECTED)) { connectedLatch.countDown(); } })); clientConfig.getConnectionStrategyConfig().setReconnectMode(ASYNC); HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig); assertTrue(client.getLifecycleService().isRunning()); assertOpenEventually(connectedLatch); IMap<Integer, Integer> map = client.getMap(randomMapName()); map.put(1, 5); hazelcastFactory.shutdownAllMembers(); HazelcastInstance[] instances = hazelcastFactory.newInstances(getConfig(), 2); assertTrueEventually(() -> { Set<Member> actualMembers = client.getCluster().getMembers(); Set<Member> expectedMembers = instances[0].getCluster().getMembers(); assertEquals(expectedMembers, actualMembers); }); assertTrueEventually(() -> { try { map.get(1); } catch (HazelcastClientOfflineException e) { <START> assertTrue(false); <END> } }); }</code><technical_language>Minor: fail()</technical_language>

Target:
public void testReconnectModeASYNCTwoMembers() { hazelcastFactory.newInstances(getConfig(), 2); CountDownLatch connectedLatch = new CountDownLatch(1); ClientConfig clientConfig = new ClientConfig(); clientConfig.addListenerConfig(new ListenerConfig((LifecycleListener) event -> { if (event.getState().equals(CLIENT_CONNECTED)) { connectedLatch.countDown(); } })); clientConfig.getConnectionStrategyConfig().setReconnectMode(ASYNC); HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig); assertTrue(client.getLifecycleService().isRunning()); assertOpenEventually(connectedLatch); IMap<Integer, Integer> map = client.getMap(randomMapName()); map.put(1, 5); hazelcastFactory.shutdownAllMembers(); HazelcastInstance[] instances = hazelcastFactory.newInstances(getConfig(), 2); assertTrueEventually(() -> { Set<Member> actualMembers = client.getCluster().getMembers(); Set<Member> expectedMembers = instances[0].getCluster().getMembers(); assertEquals(expectedMembers, actualMembers); }); assertTrueEventually(() -> { try { map.get(1); } catch (HazelcastClientOfflineException e) { fail(); } }); }
Source:
<code>public Quantifier() { this(true); <START> normalizer = new Normalizer(); <END> wordSplitPat = new Pattern[25]; wordSplitPat[0] = Pattern.compile("-(\\D)"); wordSplitPat[1] = Pattern.compile("(\\S)-"); wordSplitPat[2] = Pattern.compile("(\\d)-(\\d|\\.\\d)"); wordSplitPat[3] = Pattern.compile("(\\d),(\\d)"); wordSplitPat[4] = Pattern.compile("\\$(\\d)"); wordSplitPat[5] = Pattern.compile("(\\d)\\$"); wordSplitPat[6] = Pattern.compile("(\\d)%"); }</code><technical_language>in initalize() method other constructor</technical_language>

Target:
public Quantifier() { this(true); }
Source:
<code>public void flush() throws IOException { <START> flushCurrentLogs(); <END> flushRotatedLogs(); }</code><technical_language>change sequence here</technical_language>

Target:
public void flush() throws IOException { entryLogManager.flush(); }
Source:
<code>public CoreMessage putStringProperty(final String key, final String value) { messageChanged(); <START> checkProperties().putSimpleStringProperty(SimpleString.toSimpleString(key, getPropertyKeysPool()), SimpleString.toSimpleString(value, getPropertyValuesPool())); <END> return this; }</code><technical_language>delegate public CoreMessage putStringProperty(final SimpleString key, final String value) {</technical_language>

Target:
public CoreMessage putStringProperty(final String key, final String value) { return putStringProperty(key(key), value(value)); }
Source:
<code>public void refresh() { try { <START> List<String> lines = Files.readAllLines(Paths.get(sessionCredentials), Charset.defaultCharset()); <END> Properties props = new Properties(); for (String line : lines) { String[] tokens = line.split("="); props.put(tokens[0], tokens[1]); } sessionToken = props.getProperty("sessionToken"); accessKey = props.getProperty("accessKey"); secretKey = props.getProperty("secretKey"); } catch (IOException e) { throw new RuntimeException("cannot refresh AWS credentials", e); } }</code><technical_language>generally UTF-8 charset in Druid</technical_language>

Target:
public void refresh() { try { Properties props = new Properties(); InputStream is = new FileInputStream(new File(sessionCredentials)); props.load(is); is.close(); sessionToken = props.getProperty("sessionToken"); accessKey = props.getProperty("accessKey"); secretKey = props.getProperty("secretKey"); } catch (IOException e) { throw new RuntimeException("cannot refresh AWS credentials", e); } }
Source:
<code>public void insertHash(long hash) { long numBlocks = bitset.length / BYTES_PER_BLOCK; long lowHash = hash >>> 32; <START> int blockIndex = (int)(lowHash * numBlocks >> 32); <END> int key = (int)hash; int[] mask = setMask(key); for (int i = 0; i < BITS_SET_PER_BLOCK; i++) { int value = intBuffer.get(blockIndex * (BYTES_PER_BLOCK / 4) + i); value |= mask[i]; intBuffer.put(blockIndex * (BYTES_PER_BLOCK / 4) + i, value); } }</code><technical_language>if this product overflows? behavior compare this line operating unsigned values in C++, overflow multiplication</technical_language>

Target:
public void insertHash(long hash) { long numBlocks = bitset.length / BYTES_PER_BLOCK; long lowHash = hash >>> 32; int blockIndex = (int)((lowHash * numBlocks) >> 32); int key = (int)hash; int[] mask = setMask(key); for (int i = 0; i < BITS_SET_PER_BLOCK; i++) { int value = intBuffer.get(blockIndex * (BYTES_PER_BLOCK / 4) + i); value |= mask[i]; intBuffer.put(blockIndex * (BYTES_PER_BLOCK / 4) + i, value); } }
Source:
<code>List<Interval> intervalsFor(DateTime start, DateTime end) { long startMillis = millisBackToNearestBin(start); long endMillis = end.getMillis(); <START> if(endMillis - startMillis > 31537000000l){ END> log.error("Cannot create intervals for a total duration greater than a year"); throw new IllegalArgumentException("Cannot create intervals for a total duration greater than a year. This is to protect us from out of memory errors"); } ImmutableList.Builder<Interval> intervals = ImmutableList.builder(); while (startMillis < endMillis) { Interval interval = new Interval(new DateTime(startMillis, DateTimeZones.UTC), new DateTime(startMillis + BIN_MILLIS - 1, DateTimeZones.UTC)); intervals.add(interval); startMillis += (BIN_MILLIS); } return intervals.build(); }</code><technical_language>public static final TimeUnit.DAYS.toMillis(370) explanatory</technical_language>

Target:
List<Interval> intervalsFor(DateTime start, DateTime end) { long startMillis = millisBackToNearestBin(start); long endMillis = end.getMillis(); if (endMillis - startMillis > MAX_ALLOWED_TOTAL_INTERVAL) { log.error("Cannot create intervals for a total duration greater than " + PeriodFormat.getDefault().print(Duration.millis(MAX_ALLOWED_TOTAL_INTERVAL).toPeriod())); throw new IllegalArgumentException( "Cannot create intervals for a total duration greater than " + PeriodFormat.getDefault().print(Duration.millis(MAX_ALLOWED_TOTAL_INTERVAL).toPeriod()) + ". This is to protect us from out of memory errors."); } ImmutableList.Builder<Interval> intervals = ImmutableList.builder(); while (startMillis < endMillis) { Interval interval = new Interval(new DateTime(startMillis, DateTimeZones.UTC), new DateTime(startMillis + BIN_MILLIS - 1, DateTimeZones.UTC)); intervals.add(interval); startMillis += (BIN_MILLIS); } return intervals.build(); }
Source:
<code>public DuplicateChplProdNumber(final String origChplProductNumberA, final String origChplProductNumberB, final String newChplProductNumber) { <START> super(); <END> this.origChplProductNumberA = origChplProductNumberA; this.origChplProductNumberB = origChplProductNumberB; this.newChplProductNumber = newChplProductNumber; }</code><technical_language>This class extend anything, right? super() do here</technical_language>

Target:
public DuplicateChplProdNumber(final String origChplProductNumberA, final String origChplProductNumberB, final String newChplProductNumber) { this.origChplProductNumberA = origChplProductNumberA; this.origChplProductNumberB = origChplProductNumberB; this.newChplProductNumber = newChplProductNumber; }
Source:
<code>public void record(Trace trace) { <START> log.info(serialize(trace)); <END> }</code><technical_language>This is executed a worker thread, right? a highly-concurrent system, this a bottleneck</technical_language>

Target:
public void record(Trace trace) { if (log.isLoggable(Logger.Level.INFO)) { String json = serialize(trace); if (json != null) { log.info(json); } } }
Source:
<code>private boolean isChangeReviewed(ChangeData cd) throws OrmException { if (cd.messages(db).isEmpty()) { return false; } if (user instanceof IdentifiedUser) { Account.Id accountId = ((IdentifiedUser) user).getAccountId(); PatchSet.Id patchSetId = cd.currentPatchSet(db).getId(); <START> for (ChangeMessage cm : cd.messages(db)) { <END> if (cm.getAuthor() != null && accountId.equals(cm.getAuthor()) && cm.getPatchSetId() != null && patchSetId.equals(cm.getPatchSetId())) { return true; } } } return false; }</code><technical_language>cost server some time query data, especially a lot of data exists in DB. change query returns a small amount of changes time, tolerate it</technical_language>

Target:
private boolean isChangeReviewed(ChangeData cd) throws OrmException { if (user instanceof IdentifiedUser) { PatchSet.Id patchSetId = cd.currentPatchSet(db).getId(); List<ChangeMessage> messages = db.get().changeMessages().byPatchSet(patchSetId).toList(); if (messages.isEmpty()) { return false; } Collections.sort(messages, new Comparator<ChangeMessage>() { @Override public int compare(ChangeMessage a, ChangeMessage b) { return b.getWrittenOn().compareTo(a.getWrittenOn()); } }); Account.Id currentUserId = ((IdentifiedUser) user).getAccountId(); Account.Id changeOwnerId = cd.change(db).getOwner(); for (ChangeMessage cm : messages) { if (currentUserId.equals(cm.getAuthor())) { return true; }else if (changeOwnerId.equals(cm.getAuthor())) { return false; } } } return false; }
Source:
<code><START> public static final Range create(TypeKind typeKind) { <END> switch (typeKind) { case INT: return INT_EVERYTHING; case SHORT: return SHORT_EVERYTHING; case BYTE: return BYTE_EVERYTHING; case CHAR: return CHAR_EVERYTHING; case LONG: return LONG_EVERYTHING; default: throw new IllegalArgumentException( "create(" + typeKind + "), expected INT, SHORT, BYTE, CHAR, or LONG"); } }</code><technical_language>final needed a static method</technical_language>

Target:
public static Range create(TypeKind typeKind) { switch (typeKind) { case INT: return INT_EVERYTHING; case SHORT: return SHORT_EVERYTHING; case BYTE: return BYTE_EVERYTHING; case CHAR: return CHAR_EVERYTHING; case LONG: return LONG_EVERYTHING; default: throw new IllegalArgumentException( "create(" + typeKind + "), expected INT, SHORT, BYTE, CHAR, or LONG"); } }
Source:
<code>public Repo repo(final Repos repos) throws IOException { Repo repo = null; while (repo == null) { try { repo = repos.create( Json.createObjectBuilder() .add( "name", RandomStringUtils.randomAlphanumeric(Tv.TEN) ).add("auto_init", true).build() ); <START> } catch (final AssertionError exception) { <END> } } return repo; }</code><technical_language>this good :( log exception Logger.warn()</technical_language>

Target:
public Repo repo(final Repos repos) throws IOException { Repo repo = null; while (repo == null) { try { repo = repos.create( Json.createObjectBuilder() .add( "name", RandomStringUtils.randomAlphanumeric(Tv.TEN) ).add("auto_init", true).build() ); } catch (final AssertionError exception) { Logger.warn( this, "Create repository failed. Message: %s", exception.getMessage() ); } } return repo; }
Source:
<code>public void testRequestWithNoContentLengthHeaderOrContentReturnsEmptyBody() { serverRule.startServer(); serverRule.assertRequestEquals( new Func1<HttpClient<ByteBuf, ByteBuf>, Observable<HttpClientResponse<ByteBuf>>>() { @Override public Observable<HttpClientResponse<ByteBuf>> call(HttpClient<ByteBuf, ByteBuf> client) { return client.createGet("/"); } }, <START> "GET / HTTP/1.1\r\n" + <END> "content-length: 0\r\n" + "host: " + serverRule.getServerAddress().toString().replaceFirst("^/", "") + "\r\n" + "\r\n"); }</code><technical_language>if checking raw HTTP message is required, pass a custom handler asserts request headers content server store error/success queried later</technical_language>

Target:
public void testRequestWithNoContentLengthHeaderOrContentReturnsEmptyBody() { clientRule.sendRequest(clientRule.getHttpClient().createGet("/")); clientRule.assertEmptyBodyWithContentLengthZero(); }
Source:
<code>private void packetReceived(XBeePacket packet) { notifyPacketReceived(packet); if (!(packet instanceof XBeeAPIPacket)) return; XBeeAPIPacket apiPacket = (XBeeAPIPacket)packet; APIFrameType apiType = apiPacket.getFrameType(); if (apiType == null) return; String address = null; byte[] data = null; boolean isBroadcastData = false; switch(apiType) { case RECEIVE_PACKET: address = ((ReceivePacket)apiPacket).get64bitAddress().toString(); data = ((ReceivePacket)apiPacket).getReceivedData(); isBroadcastData = ByteUtils.isBitEnabled(((ReceivePacket)apiPacket).getReceiveOptions(), 1); break; case RX_64: address = ((RX64Packet)apiPacket).getSourceAddress().toString(); data = ((RX64Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; case RX_16: address = ((RX16Packet)apiPacket).getSourceAddress().toString(); <START> data = ((RX16Packet)apiPacket).getReceivedData(); <END> if (ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; default: break; } notifySerialDataReceived(address, data, isBroadcastData); }</code><technical_language>This check done in other place if remove here</technical_language>

Target:
private void packetReceived(XBeePacket packet) { notifyPacketReceived(packet); if (!(packet instanceof XBeeAPIPacket)) return; XBeeAPIPacket apiPacket = (XBeeAPIPacket)packet; APIFrameType apiType = apiPacket.getFrameType(); if (apiType == null) return; String address = null; byte[] data = null; boolean isBroadcastData = false; switch(apiType) { case RECEIVE_PACKET: address = ((ReceivePacket)apiPacket).get64bitAddress().toString(); data = ((ReceivePacket)apiPacket).getReceivedData(); isBroadcastData = ByteUtils.isBitEnabled(((ReceivePacket)apiPacket).getReceiveOptions(), 1); break; case RX_64: address = ((RX64Packet)apiPacket).getSourceAddress().toString(); data = ((RX64Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX64Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; case RX_16: address = ((RX16Packet)apiPacket).getSourceAddress().toString(); data = ((RX16Packet)apiPacket).getReceivedData(); if (ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 1) || ByteUtils.isBitEnabled(((RX16Packet)apiPacket).getReceiveOptions(), 2)) isBroadcastData = true; break; default: break; } if (address != null && data != null) notifySerialDataReceived(address, data, isBroadcastData); }
Source:
<code>public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vmName", "description", "domain", "os", "osType", "creationDate", "numOfMonitors", "allowConsoleReconnect", "usbPolicy", "autoSuspend", "autoStartup", "dedicatedVmForVds", "defaultDisplayType", "priority", "defaultBootSequence", "initrdUrl", "kernelUrl", "kernelParams", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), <START> Arrays.asList(new String[] { "vds_group_id", "time_zone", "is_stateless", "nice_level", "mem_size_mb", <END> "num_of_sockets", "cpu_per_socket", "iso_path", "userDefinedProperties", "predefinedProperties", "customProperties" })); }</code><technical_language>this needs update</technical_language>

Target:
public static void Init() { mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(new String[] { "VM", "VmStatic", "VmDynamic" }), VMStatus.class); mUpdateVmsStatic.AddPermittedFields(new String[] { "vm_name", "description", "domain", "os", "osType", "creation_date", "num_of_monitors", "allowConsoleReconnect", "usb_policy", "is_auto_suspend", "auto_startup", "dedicated_vm_for_vds", "default_display_type", "priority", "default_boot_sequence", "initrd_url", "kernel_rl", "kernel_params", "migrationSupport", "minAllocatedMem", "quotaId", "quotaName", "quotaEnforcementType", "cpuPinning", "vmPayload", "balloonEnabled", "smartcardEnabled", "images", "interfaces" }); mUpdateVmsStatic.AddFields( Arrays.asList(new Enum<?>[] { VMStatus.Down }), Arrays.asList(new String[] { "vdsGroupId", "timeZone", "stateless", "niceLevel", "memSizeMb", "numOfSockets", "cpuPerSocket", "isoPath", "userDefinedProperties", "predefinedProperties", "customProperties" })); }
Source:
<code>public void testDataInfo() throws IOException, TasteException { <START> MovieRecommender recommender = new MovieRecommender("C:/datos/movies.txt"); <END> assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }</code><technical_language>This hardcoded</technical_language>

Target:
public void testDataInfo() throws IOException, TasteException { MovieRecommender recommender = new MovieRecommender("../movies.txt"); assertEquals(7911684, recommender.getTotalReviews()); assertEquals(253059, recommender.getTotalProducts()); assertEquals(889176, recommender.getTotalUsers()); List<String> recommendations = recommender.getRecommendationsForUser("A141HP4LYPWMSR"); assertThat(recommendations, hasItem("B0002O7Y8U")); assertThat(recommendations, hasItem("B00004CQTF")); assertThat(recommendations, hasItem("B000063W82")); }
Source:
<code>protected String getJobName(JobContext ctx, Long id) { String jobname = null; if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; <START> String jobNamePrefix = processCtx.getSessionId() + "-"; <END> jobname = processCtx.getProcessInstanceId() + "-" + processCtx.getTimer().getId(); if (processCtx instanceof StartProcessJobContext) { jobname = jobNamePrefix + "StartProcess-" + ((StartProcessJobContext) processCtx).getProcessId() + "-" + processCtx.getTimer().getId(); } } else if (ctx instanceof NamedJobContext) { jobname = ((NamedJobContext) ctx).getJobName(); } else { jobname = "Timer-"+ctx.getClass().getSimpleName()+ "-" + id; } return jobname; }</code><technical_language>actual deployment id prefix? String jobNamePrefix = processCtx.getKnowledgeRuntime().getEnvironment().get(EnvironmentName.DEPLOYMENT_ID) + "-";</technical_language>

Target:
protected String getJobName(JobContext ctx, Long id) { String jobname = null; if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; jobname = processCtx.getSessionId() + "-" + processCtx.getProcessInstanceId() + "-" + processCtx.getTimer().getId(); if (processCtx instanceof StartProcessJobContext) { String deploymentId = (String) processCtx.getKnowledgeRuntime().getEnvironment().get(EnvironmentName.DEPLOYMENT_ID); jobname = deploymentId + "-StartProcess-" + ((StartProcessJobContext) processCtx).getProcessId() + "-" + processCtx.getTimer().getId(); } } else if (ctx instanceof NamedJobContext) { jobname = ((NamedJobContext) ctx).getJobName(); } else { jobname = "Timer-"+ctx.getClass().getSimpleName()+ "-" + id; } return jobname; }
Source:
<code>private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.STARTED) { <START> model.setMessage(ConstantsManager.getInstance() <END> .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }</code><technical_language>a string is set conditionally 1 single model.setmessage thatstring bottom 1 message is compulsorily right</technical_language>

Target:
private void restoreSnapshot() { if (getSelectedItem() == null) { return; } ConfirmationModel model = new ConfirmationModel(); GlusterVolumeSnapshotEntity snapshot = (GlusterVolumeSnapshotEntity) getSelectedItem(); setConfirmWindow(model); model.setTitle(ConstantsManager.getInstance().getMessages().confirmRestoreSnapshot(getEntity().getName())); model.setHelpTag(HelpTag.volume_restore_snapshot_confirmation); model.setHashName("volume_restore_snapshot_confirmation"); if (snapshot.getStatus() == GlusterSnapshotStatus.ACTIVATED) { model.setMessage(ConstantsManager.getInstance() .getConstants() .confirmVolumeSnapshotRestoreWithStopMessage()); } else { model.setMessage(ConstantsManager.getInstance().getConstants().confirmVolumeSnapshotRestoreMesage()); } UICommand okCommand = UICommand.createDefaultOkUiCommand("onRestoreSnapshot", this); model.getCommands().add(okCommand); UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this); model.getCommands().add(cancelCommand); }
Source:
<code><START> private static void toggleSwitches(Block signBlock) { <END> Sign sign = (Sign) signBlock.getState().getData(); BlockFace[] checkFaces = new BlockFace[4]; checkFaces[0] = BlockFace.UP; checkFaces[1] = BlockFace.DOWN; switch (sign.getFacing()) { case EAST: case WEST: checkFaces[2] = BlockFace.NORTH; checkFaces[3] = BlockFace.SOUTH; break; default: checkFaces[2] = BlockFace.EAST; checkFaces[3] = BlockFace.WEST; break; } for (BlockFace blockFace : checkFaces) { final Block checkBlock = signBlock.getRelative(blockFace); if (checkBlock.getType() == Material.LEVER) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(!powerable.isPowered()); checkBlock.setBlockData(powerable); } else if (Tag.BUTTONS.getValues().contains(checkBlock.getType())) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(true); checkBlock.setBlockData(powerable); powerable.setPowered(false); Runnable turnOff = () -> checkBlock.setBlockData(powerable); Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), turnOff, Tag.WOODEN_BUTTONS.getValues().contains(checkBlock.getType()) ? 30L : 20L); } } }</code><technical_language>Is a reason grabbing sign passing through? Passing means allocation of a state object</technical_language>

Target:
private static void toggleSwitches(Block signBlock) { Sign sign = (Sign) signBlock.getState().getData(); BlockFace[] checkFaces = new BlockFace[4]; checkFaces[0] = BlockFace.UP; checkFaces[1] = BlockFace.DOWN; switch (sign.getFacing()) { case EAST: case WEST: checkFaces[2] = BlockFace.NORTH; checkFaces[3] = BlockFace.SOUTH; break; default: checkFaces[2] = BlockFace.EAST; checkFaces[3] = BlockFace.WEST; break; } for (BlockFace blockFace : checkFaces) { final Block checkBlock = signBlock.getRelative(blockFace); if (checkBlock.getType() == Material.LEVER) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(!powerable.isPowered()); checkBlock.setBlockData(powerable); Switch lever = (Switch) checkBlock.getBlockData(); Block targetBlock = checkBlock.getRelative(lever.getFacing().getOppositeFace()); applyPhysicsToBlock(targetBlock); } else if (Tag.BUTTONS.getValues().contains(checkBlock.getType())) { Powerable powerable = (Powerable) checkBlock.getBlockData(); powerable.setPowered(true); checkBlock.setBlockData(powerable); Switch button = (Switch) checkBlock.getBlockData(); Block targetBlock = checkBlock.getRelative(button.getFacing().getOppositeFace()); applyPhysicsToBlock(targetBlock); Runnable turnOff = () -> turnOffButton(checkBlock, targetBlock, powerable); Bukkit.getScheduler().runTaskLater(CraftBookPlugin.inst(), turnOff, Tag.WOODEN_BUTTONS.getValues().contains(checkBlock.getType()) ? 30L : 20L); } } }
Source:
<code>public static ProgramWorkflowState getState(String identifier) { ProgramWorkflowState state = null; if (identifier != null) { try { identifier = identifier.trim(); Integer id = Integer.valueOf(identifier); state = getState(id); if (state != null) { return state; } } catch (NumberFormatException e) int index = identifier.indexOf(":"); if(index != -1){ <START> return getMetadata(identifier, ProgramWorkflowState.class, index); <END> } if (isValidUuidFormat(identifier)) { state = Context.getProgramWorkflowService().getStateByUuid(identifier); if (state != null) { return state; } } } return null; }</code><technical_language>This feels strange reading... I change this bit of code to: ProgramWorkflowState state = getMetadataByMapping(ProgramWorkflowState.class, identifier); if (state != null) { return state; }</technical_language>

Target:
public static ProgramWorkflowState getState(String identifier) { ProgramWorkflowState state = null; if (identifier != null) { try { identifier = identifier.trim(); Integer id = Integer.valueOf(identifier); state = getState(id); if (state != null) { return state; } } catch (NumberFormatException e) state = getMetadataByMapping(ProgramWorkflowState.class, identifier); if (state != null) { return state; } if (isValidUuidFormat(identifier)) { state = Context.getProgramWorkflowService().getStateByUuid(identifier); if (state != null) { return state; } } } return null; }
Source:
<code>public OAuth2ServiceProvider getProvider(String serviceName) { DocumentModel model = getProviderDocModel(serviceName); <START> return model != null ? buildProvider(model): null; <END> }</code><technical_language>I prefer model == null ? null : buildProvider(model) avoid negations. please of a space left right of :</technical_language>

Target:
public OAuth2ServiceProvider getProvider(String serviceName) { DocumentModel model = getProviderDocModel(serviceName); return model == null ? null : buildProvider(model); }
Source:
<code>private void tryToAddVariant(final VariantContext vc, final ReferenceSequence refSeq, final VariantContext source) { if (!refSeq.getName().equals(vc.getContig())) { throw new IllegalStateException("The contig of the VariantContext, " + vc.getContig() + ", doesnt match the ReferenceSequence: " + refSeq.getName()); } boolean mismatchesReference = false; for (final Allele allele : vc.getAlleles()) { if (allele.isReference()) { final byte[] ref = refSeq.getBases(); final String refString = StringUtil.bytesToString(ref, vc.getStart() - 1, vc.getEnd() - vc.getStart() + 1); if (!refString.equalsIgnoreCase(allele.getBaseString())) { if (vc.getAlleles().size() == 2 && <START> vc.getAlleles().stream().map(Allele::length).allMatch(l -> l == 1) && <END> refString.equalsIgnoreCase(vc.getAlleles().stream().filter(Allele::isNonReference).findFirst().get().getBaseString())) { sorter.add(LiftoverUtils.swapRefAlt(vc,TAGS_TO_REVERSE, TAGS_TO_DROP)); return; } mismatchesReference = true; } break; } } if (mismatchesReference) { rejects.add(new VariantContextBuilder(source) .filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .make()); failedAlleleCheck++; } else { sorter.add(vc); } }</code><technical_language>This is weird. isBiallelic() isSNP()</technical_language>

Target:
private void tryToAddVariant(final VariantContext vc, final ReferenceSequence refSeq, final VariantContext source) { if (!refSeq.getName().equals(vc.getContig())) { throw new IllegalStateException("The contig of the VariantContext, " + vc.getContig() + ", doesnt match the ReferenceSequence: " + refSeq.getName()); } boolean mismatchesReference = false; for (final Allele allele : vc.getAlleles()) { if (allele.isReference()) { final byte[] ref = refSeq.getBases(); final String refString = StringUtil.bytesToString(ref, vc.getStart() - 1, vc.getEnd() - vc.getStart() + 1); if (!refString.equalsIgnoreCase(allele.getBaseString())) { if (vc.isBiallelic() && vc.isSNP() && refString.equalsIgnoreCase(vc.getAlternateAllele(0).getBaseString())) { sorter.add(LiftoverUtils.swapRefAlt(vc, TAGS_TO_REVERSE, TAGS_TO_DROP)); return; } mismatchesReference = true; } break; } } if (mismatchesReference) { rejects.add(new VariantContextBuilder(source) .filter(FILTER_MISMATCHING_REF_ALLELE) .attribute(ATTEMPTED_LOCUS, String.format("%s:%d-%d", vc.getContig(), vc.getStart(), vc.getEnd())) .make()); failedAlleleCheck++; } else { sorter.add(vc); } }
Source:
<code>public String getJobCoordinationUtilsFactoryClassName() { String coordinatorFactory = get(JOB_COORDINATOR_FACTORY, DEFAULT_COORDINATOR_UTILS_FACTORY); String coordinationUtilsFactory; if (Objects.equals(coordinatorFactory, AZURE_COORDINATOR_FACTORY)) { coordinationUtilsFactory = AZURE_COORDINATION_UTILS_FACTORY; <START> } else if (Objects.equals(coordinatorFactory, PassthroughJobCoordinatorFactory.class.getName())) { <END> coordinationUtilsFactory = PassthroughCoordinationUtilsFactory.class.getName(); } else { coordinationUtilsFactory = ZkCoordinationUtilsFactory.class.getName(); } try { Class.forName(coordinationUtilsFactory); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATOR_FACTORY + " = " + coordinationUtilsFactory, e); } return coordinationUtilsFactory; }</code><technical_language>Object.equals for string equals</technical_language>

Target:
public String getJobCoordinationUtilsFactoryClassName() { String coordinatorFactory = get(JOB_COORDINATOR_FACTORY, DEFAULT_COORDINATOR_FACTORY); String coordinationUtilsFactory; if (AZURE_COORDINATOR_FACTORY.equals(coordinatorFactory)) { coordinationUtilsFactory = AZURE_COORDINATION_UTILS_FACTORY; } else if (PassthroughJobCoordinatorFactory.class.getName().equals(coordinatorFactory)) { coordinationUtilsFactory = PassthroughCoordinationUtilsFactory.class.getName(); } else if (ZkJobCoordinatorFactory.class.getName().equals(coordinatorFactory)) { coordinationUtilsFactory = ZkCoordinationUtilsFactory.class.getName(); } else { throw new SamzaException(String.format("Coordination factory: %s defined by the config: %s is invalid.", coordinatorFactory, JOB_COORDINATOR_FACTORY)); } try { Class.forName(coordinationUtilsFactory); } catch (ClassNotFoundException e) { throw new SamzaException( "Failed to validate config value for " + JOB_COORDINATOR_FACTORY + " = " + coordinationUtilsFactory, e); } return coordinationUtilsFactory; }
Source:
<code>public Dictionary<String, String> decrypt(final Dictionary config) { StringEncryptor encryptor = null; Dictionary<String, String> decryptedConfig = new Hashtable<String, String>(); for (Enumeration e = config.keys(); e.hasMoreElements();) { final String key = (String) e.nextElement(); Object value = config.get(key); if (value instanceof String && isEncrypted((String)value)) { String strValue = (String) value; String cipherText = strValue.substring(ENCRYPTED_PROPERTY_PREFIX.length(), strValue.length() - ENCRYPTED_PROPERTY_SUFFIX.length()); if(encryptor == null) { try { encryptor = (StringEncryptor) this.encryptorServiceTracker.waitForService(30000); } catch (InterruptedException e1) { } } if (encryptor != null) { String plainText = encryptor.decrypt(cipherText); decryptedConfig.put(key, plainText); } } else { <START> decryptedConfig.put(key,String.valueOf(value)); <END> } } return decryptedConfig; }</code><technical_language>strings encrypted, String.valueOf line 39, rest same? Second, OPS4j, mandatory constraint for accepting PullRequest (and especially for bugfixes): Do a unit test for this fix? Otherwise, is verify this fixes problem, more important detect a regression in future changes</technical_language>

Target:
public Dictionary<String, String> decrypt(final Dictionary config) { StringEncryptor encryptor = null; Dictionary<String, String> decryptedConfig = new Hashtable<String, String>(); for (Enumeration e = config.keys(); e.hasMoreElements();) { final String key = (String) e.nextElement(); String value = String.valueOf(config.get(key)); if (config.get(key) instanceof String && isEncrypted(value)){ String cipherText = value.substring(ENCRYPTED_PROPERTY_PREFIX.length(), value.length() - ENCRYPTED_PROPERTY_SUFFIX.length()); if(encryptor == null) { try { encryptor = (StringEncryptor) this.encryptorServiceTracker.waitForService(30000); } catch (InterruptedException e1) { } } if (encryptor != null) { String plainText = encryptor.decrypt(cipherText); decryptedConfig.put(key, plainText); } } else { decryptedConfig.put(key,value); } } return decryptedConfig; }