auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public ServiceDiscoveringAtlasSupplier( KeyValueServiceConfig config, java.util.function.Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig, Optional<LeaderConfig> leaderConfig, Optional<String> namespace, <START> Optional<TableReference> timestampTable, <END> boolean initializeAsync, QosClient qosClient, LongSupplier timestampSupplier) { this.config = config; this.leaderConfig = leaderConfig; AtlasDbFactory atlasFactory = createAtlasFactoryOfCorrectType(config); keyValueService = Suppliers.memoize( () -> atlasFactory.createRawKeyValueService( config, runtimeConfig, leaderConfig, namespace, initializeAsync, qosClient, timestampSupplier)); timestampService = () -> atlasFactory.createTimestampService(getKeyValueService(), timestampTable, initializeAsync); timestampStoreInvalidator = () -> atlasFactory.createTimestampStoreInvalidator(getKeyValueService()); }</code><technical_language>This timestampTable arg is empty</technical_language>

Target:
public ServiceDiscoveringAtlasSupplier( KeyValueServiceConfig config, java.util.function.Supplier<Optional<KeyValueServiceRuntimeConfig>> runtimeConfig, Optional<LeaderConfig> leaderConfig, Optional<String> namespace, Optional<TableReference> timestampTable, boolean initializeAsync, QosClient qosClient, LongSupplier timestampSupplier) { this.config = config; this.leaderConfig = leaderConfig; AtlasDbFactory atlasFactory = createAtlasFactoryOfCorrectType(config); keyValueService = Suppliers.memoize( () -> atlasFactory.createRawKeyValueService( config, runtimeConfig, leaderConfig, namespace, timestampSupplier, initializeAsync, qosClient)); timestampService = () -> atlasFactory.createTimestampService(getKeyValueService(), timestampTable, initializeAsync); timestampStoreInvalidator = () -> atlasFactory.createTimestampStoreInvalidator(getKeyValueService()); }
Source:
<code><START> public static boolean isPhantomActive(EntityPlayer entity) { <END> for (int i = 0; i < entity.inventory.getSizeInventory(); i++) { ItemStack stack = entity.inventory.getStackInSlot(i); if (stack.getItem() instanceof ItemSigilPhantomBridge) return NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED); if (stack.getItem() instanceof ItemSigilHolding){ List<ItemStack> inv = ItemSigilHolding.getInternalInventory(stack); for (int j = 0; i < ItemSigilHolding.inventorySize; i++) { ItemStack invStack = inv.get(i); if (invStack.getItem() instanceof ItemSigilPhantomBridge) return NBTHelper.checkNBT(invStack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED); } } } return false; }</code><technical_language>Static methods member methods</technical_language>

Target:
public static boolean isPhantomActive(EntityPlayer entity) { for (int i = 0; i < entity.inventory.getSizeInventory(); i++) { ItemStack stack = entity.inventory.getStackInSlot(i); if (stack.getItem() instanceof ItemSigilPhantomBridge) return NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED); if (stack.getItem() instanceof ItemSigilHolding) { List<ItemStack> inv = ItemSigilHolding.getInternalInventory(stack); for (int j = 0; j < ItemSigilHolding.inventorySize; j++) { ItemStack invStack = inv.get(j); if (invStack.getItem() instanceof ItemSigilPhantomBridge) return NBTHelper.checkNBT(invStack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED); } } } return false; }
Source:
<code><I, E extends Entity<I, ?>> void registerAndAssertRepository(Class<E> cls) { boundedContext.register(DefaultRepository.of(cls)); assertThat(boundedContext.hasRepositoryOf(cls)) <START> .isTrue(); <END> }</code><technical_language>assertTrue is better, I think. shorter easier read</technical_language>

Target:
<I, E extends Entity<I, ?>> void registerAndAssertRepository(Class<E> cls) { boundedContext.register(DefaultRepository.of(cls)); assertTrue(boundedContext.hasEntitiesOfType(cls)); }
Source:
<code>public Mono<Void> shutdown() { return Mono.defer(() -> { sink.complete(); <START> return cluster != null ? Mono.fromFuture(cluster.shutdown()) : Mono.empty(); <END> }); }</code><technical_language>In accordance similar changes Optional</technical_language>

Target:
public Mono<Void> shutdown() { return Mono.defer( () -> { sink.complete(); return Optional.ofNullable(cluster) .map(cluster1 -> Mono.fromFuture(cluster1.shutdown())) .orElse(Mono.empty()); }); }
Source:
<code>private Element disseminateElement(DisseminationCrosswalk crosswalk, DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException { Element dissemination; if (crosswalk instanceof METSRightsCrosswalk) { <START> dissemination = ((METSRightsCrosswalk)crosswalk).disseminateElement(context,dso); <END> } else { dissemination = crosswalk.disseminateElement(dso); } return dissemination; }</code><technical_language>worried fact this new disseminateElement(context,dso) method is XMLUI. While change for this bug fix, means this method called a Curation Task runs CLI JSPUI similar</technical_language>

Target:
private Element disseminateElement(DisseminationCrosswalk crosswalk, DSpaceObject dso) throws CrosswalkException, IOException, SQLException, AuthorizeException { Element dissemination; if(crosswalk instanceof ContextAwareDisseminationCrosswalk) { ((ContextAwareDisseminationCrosswalk)crosswalk).setContext(context); } dissemination = crosswalk.disseminateElement(dso); return dissemination; }
Source:
<code>private DataSegment createDataSegment(String dataSource) { return new DataSegment( dataSource, new Interval("0/3000"), new DateTime().toString(), <START> Maps.<String, Object>newHashMap(), <END> Lists.<String>newArrayList(), Lists.<String>newArrayList(), NoneShardSpec.instance(), 0, 0 ); }</code><technical_language>Line 626:628, collection type auto inferred</technical_language>

Target:
private DataSegment createDataSegment(String dataSource) { return new DataSegment( dataSource, new Interval("0/3000"), new DateTime().toString(), Maps.newHashMap(), Lists.newArrayList(), Lists.newArrayList(), NoneShardSpec.instance(), 0, 0 ); }
Source:
<code>public HWDiskStore() { name = ""; model = ""; serial = ""; <START> size = 0L; <END> reads = 0L; readBytes = 0L; writes = 0L; writeBytes = 0L; currentQueueLength = 0L; transferTime = 0L; partitions = new HWPartition[0]; timeStamp = 0L; }</code><technical_language>this is unnecessary default initialization</technical_language>

Target:
public HWDiskStore() { }
Source:
<code>private void decrementReferenceCounts(PlanNode fromNode, int fromGroup) { Set<Integer> references = getAllReferences(fromNode); for (int group : references) { Group childGroup = groups.get(group); checkState(childGroup.references.remove(fromGroup), "Reference to remove not found"); if (childGroup.references.isEmpty()) { <START> deleteGroup(group); <END> } } }</code><technical_language>commit message s/call-size/call-site</technical_language>

Target:
private void decrementReferenceCounts(PlanNode fromNode, int fromGroup) { Set<Integer> references = getAllReferences(fromNode); for (int group : references) { Group childGroup = groups.get(group); checkState(childGroup.incomingReferences.remove(fromGroup), "Reference to remove not found"); if (childGroup.incomingReferences.isEmpty()) { deleteGroup(group); } } }
Source:
<code><START> public String getDetailedStatus() { <END> return _detailedStatus; }</code><technical_language>Is this a textual description this enum</technical_language>

Target:
public DetailedStatus getDetailedStatus() { return _detailedStatus; }
Source:
<code>private static int parseConnectionValue(String value) { try { return CoordinateConverter.INSTANCE.convertFrom1499XML(value); } <START> catch (Exception ex) { <END> return 0; } }</code><technical_language>do want catch exceptions? Based implementation of convertFrom1499XML I narrow this NumberFormatException, this is reasonable exception I suspect</technical_language>

Target:
private static int parseConnectionValue(String value) { try { return CoordinateConverter.INSTANCE.convertFrom1499XML(value); } catch (NumberFormatException ex) { return 0; } }
Source:
<code><START> protected SynchronizedConfigurationListener getConfigListener(String pid) { <END> return new SynchronizedConfigurationListener(pid); }</code><technical_language>This visible for testing. package private annotate @VisibleForTesting</technical_language>

Target:
SynchronizedConfigurationListener getConfigListener(String pid) { return new SynchronizedConfigurationListener(pid); }
Source:
<code>private synchronized void init(TxnView txn, boolean reinit){ try { SpliceTransactionResourceImpl txnResource = impl.get(); if (txnResource != null && activation != null) return; txnResource = new SpliceTransactionResourceImpl(); txnResource.marshallTransaction(txn); impl.set(txnResource); activation = soi.getActivation(this, txnResource.getLcc()); EmbedConnection internalConnection = (EmbedConnection)EngineDriver.driver().getInternalConnection(); new EmbedConnectionContext(ContextService.getService().getCurrentContextManager(), internalConnection); if (reinit) { SpliceOperationContext context = SpliceOperationContext.newContext(activation); for (SpliceOperation so : operationsList) { so.init(context); <START> } <END> } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>deserializing ActivationHolder, empty version of constructor is called, "initialized" get set, call getActivation for serialized objects call init. want set initialized true here</technical_language>

Target:
private void init(TxnView txn, boolean reinit){ try { SpliceTransactionResourceImpl txnResource = impl.get(); if (txnResource != null && activation != null) return; txnResource = new SpliceTransactionResourceImpl(); txnResource.marshallTransaction(txn); impl.set(txnResource); activation = soi.getActivation(this, txnResource.getLcc()); EmbedConnection internalConnection = (EmbedConnection)EngineDriver.driver().getInternalConnection(); new EmbedConnectionContext(ContextService.getService().getCurrentContextManager(), internalConnection); if (reinit) { SpliceOperationContext context = SpliceOperationContext.newContext(activation); for (SpliceOperation so : operationsList) { so.init(context); } } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public synchronized void afterDisconnect(SlaveComputer slaveComputer, TaskListener listener) { if (connection != null) { boolean connectionLost = reportTransportLoss(connection, listener); if (session!=null) { try { listener.getLogger().println(getSessionOutcomeMessage(session,connectionLost)); session.getStdout().close(); session.close(); } catch (Throwable t) { t.printStackTrace(listener.error(Messages.SSHLauncher_ErrorWhileClosingConnection())); } session = null; } Slave n = slaveComputer.getNode(); if (n != null && !connectionLost) { String workingDirectory = getWorkingDirectory(n); String fileName = workingDirectory + "/slave.jar"; SFTPv3Client sftpClient = null; try { sftpClient = new SFTPv3Client(connection); sftpClient.rm(fileName); } catch (Exception e) { if (sftpClient == null) { try { connection.exec("rm " + fileName, listener.getLogger()); <START> } catch (Throwable x) { <END> x.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); } } else { e.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); } } finally { if (sftpClient != null) { sftpClient.close(); } } } PluginImpl.unregister(connection); cleanupConnection(listener); } }</code><technical_language>letting Error fall through. a change findbugs</technical_language>

Target:
public synchronized void afterDisconnect(SlaveComputer slaveComputer, TaskListener listener) { if (connection != null) { boolean connectionLost = reportTransportLoss(connection, listener); if (session!=null) { try { listener.getLogger().println(getSessionOutcomeMessage(session,connectionLost)); session.getStdout().close(); session.close(); } catch (Throwable t) { t.printStackTrace(listener.error(Messages.SSHLauncher_ErrorWhileClosingConnection())); } session = null; } Slave n = slaveComputer.getNode(); if (n != null && !connectionLost) { String workingDirectory = getWorkingDirectory(n); String fileName = workingDirectory + "/slave.jar"; SFTPv3Client sftpClient = null; try { sftpClient = new SFTPv3Client(connection); sftpClient.rm(fileName); } catch (Exception e) { if (sftpClient == null) { try { connection.exec("rm " + fileName, listener.getLogger()); } catch (Error error) { throw error; } catch (Throwable x) { x.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); } } else { e.printStackTrace(listener.error(Messages.SSHLauncher_ErrorDeletingFile(getTimestamp()))); } } finally { if (sftpClient != null) { sftpClient.close(); } } } PluginImpl.unregister(connection); cleanupConnection(listener); } }
Source:
<code>public static void addNextRow( final Supplier<Committer> committerSupplier, final Firehose firehose, final Plumber plumber, final boolean reportParseExceptions, final FireDepartmentMetrics metrics ) { final InputRow inputRow; try { inputRow = firehose.nextRow(); } <START> catch (ParseException | IOException e) { <END> if (e instanceof ParseException && reportParseExceptions) { throw (ParseException) e; } else { log.debug(e, "Discarded row due to exception, considering unparseable."); metrics.incrementUnparseable(); return; } } if (inputRow == null) { log.debug("Discarded null row, considering thrownAway."); metrics.incrementThrownAway(); return; } final IncrementalIndexAddResult addResult; try { addResult = plumber.add(inputRow, committerSupplier); } catch (IndexSizeExceededException e) { throw new ISE(e, "WTF?! Index size exceeded, this shouldn't happen. Bad Plumber!"); } if (addResult.getRowCount() == -1) { metrics.incrementThrownAway(); log.debug("Discarded row[%s], considering thrownAway due to %s.", inputRow, addResult.getReasonOfNotAdded()); return; } if (addResult.getRowCount() == -2) { metrics.incrementDedup(); log.debug("Discarded row[%s], considering duplication.", inputRow); return; } metrics.incrementProcessed(); }</code><technical_language>I IOException is in spirit ParseException treated same. modify Plumbers.addNextRow throws IOException instead of catching IOException here</technical_language>

Target:
public static void addNextRow( final Supplier<Committer> committerSupplier, final Firehose firehose, final Plumber plumber, final boolean reportParseExceptions, final FireDepartmentMetrics metrics ) throws IOException { final InputRow inputRow; try { inputRow = firehose.nextRow(); } catch (ParseException e) { if (reportParseExceptions) { throw e; } else { log.debug(e, "Discarded row due to exception, considering unparseable."); metrics.incrementUnparseable(); return; } } if (inputRow == null) { log.debug("Discarded null row, considering thrownAway."); metrics.incrementThrownAway(); return; } final IncrementalIndexAddResult addResult; try { addResult = plumber.add(inputRow, committerSupplier); } catch (IndexSizeExceededException e) { throw new ISE(e, "WTF?! Index size exceeded, this shouldn't happen. Bad Plumber!"); } if (addResult.getRowCount() == -1) { metrics.incrementThrownAway(); log.debug("Discarded row[%s], considering thrownAway due to %s.", inputRow, addResult.getReasonOfNotAdded()); return; } if (addResult.getRowCount() == -2) { metrics.incrementDedup(); log.debug("Discarded row[%s], considering duplication.", inputRow); return; } metrics.incrementProcessed(); }
Source:
<code>public DbHelper(Context context, boolean persistent) { super(context, persistent ? DATABASE_NAME : null, null, DATABASE_VERSION); SharedPreferences pref = context.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); boolean encrypt = pref.getBoolean(Advanced.ENCRYPT_SENSOR_DATA, false); if (encrypt) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = telephonyManager.getDeviceId(); setPassphrase(imei); } SQLiteDatabase.loadLibs(context); if (persistent && encrypt) { try { getWritableDatabase(passphrase); } catch (SQLiteException e) { <START> Log.v(TAG, "Encrypting old database with passphrase "+passphrase); <END> File plain = context.getDatabasePath(DATABASE_NAME); File encrypted = context.getDatabasePath("tmp.db"); SQLiteDatabase migrate_db = SQLiteDatabase.openOrCreateDatabase(plain, "", null); migrate_db.rawExecSQL(String.format("ATTACH DATABASE '%s' AS encrypted KEY '%s'", encrypted.getAbsolutePath(), passphrase)); migrate_db.rawExecSQL("SELECT sqlcipher_export('encrypted');"); migrate_db.execSQL("DETACH DATABASE encrypted;"); migrate_db.close(); encrypted.renameTo(new File(plain.getAbsolutePath())); } } }</code><technical_language>@orhan89 This removed, if give password encyrpt</technical_language>

Target:
public DbHelper(Context context, boolean persistent) { super(context, persistent ? DATABASE_NAME : null, null, DATABASE_VERSION); if (null == sMainPrefs) { sMainPrefs = context.getSharedPreferences(SensePrefs.MAIN_PREFS, Context.MODE_PRIVATE); } boolean encrypt = sMainPrefs.getBoolean(Advanced.ENCRYPT_DATABASE, false); if (encrypt) { TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String imei = telephonyManager.getDeviceId(); setPassphrase(imei); } SQLiteDatabase.loadLibs(context); if (persistent && encrypt) { try { getWritableDatabase(passphrase); } catch (SQLiteException e) { Log.v(TAG, "Trying to encrypte old plain database"); File plain = context.getDatabasePath(DATABASE_NAME); File encrypted = context.getDatabasePath("tmp.db"); SQLiteDatabase migrate_db = SQLiteDatabase.openOrCreateDatabase(plain, "", null); migrate_db.rawExecSQL(String.format("ATTACH DATABASE '%s' AS encrypted KEY '%s'", encrypted.getAbsolutePath(), passphrase)); migrate_db.rawExecSQL("SELECT sqlcipher_export('encrypted');"); migrate_db.execSQL("DETACH DATABASE encrypted;"); migrate_db.close(); encrypted.renameTo(new File(plain.getAbsolutePath())); } } }
Source:
<code>private Properties getDeploymentProperties(String metadataPath) { Map<String, String> deploymentProperties = new HashMap<String, String>(); try { String moduleDeploymentsPath = metadataPath.substring(0, metadataPath.lastIndexOf("/")); deploymentProperties = mapBytesUtility.toMap(zkConnection.getClient().getData().forPath( moduleDeploymentsPath)); } catch (Exception e) { <START> ZooKeeperUtils.wrapAndThrowIgnoring(e); <END> } return MapUtils.toProperties(deploymentProperties); }</code><technical_language>I "ignoring" version of this method passing more Exception class(es) ignore</technical_language>

Target:
private Properties getDeploymentProperties(String metadataPath) { Map<String, String> deploymentProperties = new HashMap<String, String>(); try { String moduleDeploymentsPath = metadataPath.substring(0, metadataPath.lastIndexOf("/")); deploymentProperties = mapBytesUtility.toMap(zkConnection.getClient().getData().forPath( moduleDeploymentsPath)); } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return MapUtils.toProperties(deploymentProperties); }
Source:
<code>public void testCheckoutOursWhenNoBase() throws Exception { String file = "added.txt"; git.checkout().setCreateBranch(true).setName("side") .setStartPoint(initialCommit).call(); writeTrashFile(file, "Added on side"); git.add().addFilepattern(file).call(); RevCommit side = git.commit().setMessage("Commit on side").call(); git.checkout().setName("master").call(); writeTrashFile(file, "Added on master"); git.add().addFilepattern(file).call(); git.commit().setMessage("Commit on master").call(); git.merge().include(side).call(); assertEquals(RepositoryState.MERGING, db.getRepositoryState()); DirCache cache = DirCache.read(db.getIndexFile(), db.getFS()); assertEquals("Expected add/add file to not have base stage", DirCacheEntry.STAGE_2, cache.getEntry(file).getStage()); <START> <END> git.checkout().setStage(Stage.OURS).addPath(file).call(); assertEquals("Added on master", read(file)); cache = DirCache.read(db.getIndexFile(), db.getFS()); assertEquals("Expected conflict stages to still exist after checkout", DirCacheEntry.STAGE_2, cache.getEntry(file).getStage()); }</code><technical_language>clarify checkout is touching file I assert content of file checkout assertTrue(read(file).startsWith("<<<<<<< HEAD"));</technical_language>

Target:
public void testCheckoutOursWhenNoBase() throws Exception { String file = "added.txt"; git.checkout().setCreateBranch(true).setName("side") .setStartPoint(initialCommit).call(); writeTrashFile(file, "Added on side"); git.add().addFilepattern(file).call(); RevCommit side = git.commit().setMessage("Commit on side").call(); git.checkout().setName("master").call(); writeTrashFile(file, "Added on master"); git.add().addFilepattern(file).call(); git.commit().setMessage("Commit on master").call(); git.merge().include(side).call(); assertEquals(RepositoryState.MERGING, db.getRepositoryState()); DirCache cache = DirCache.read(db.getIndexFile(), db.getFS()); assertEquals("Expected add/add file to not have base stage", DirCacheEntry.STAGE_2, cache.getEntry(file).getStage()); assertTrue(read(file).startsWith("<<<<<<< HEAD")); git.checkout().setStage(Stage.OURS).addPath(file).call(); assertEquals("Added on master", read(file)); cache = DirCache.read(db.getIndexFile(), db.getFS()); assertEquals("Expected conflict stages to still exist after checkout", DirCacheEntry.STAGE_2, cache.getEntry(file).getStage()); }
Source:
<code>public void star() throws IOException { this.entry.uri() <START> .path(RtGist.PATH_ELEMENT_STAR).back().method("PUT") <END> .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_NO_CONTENT); }</code><technical_language>obvious code duplication. save this new request a modified URI this.request, in methods. This is works in other classes, a</technical_language>

Target:
public void star() throws IOException { this.request.method("PUT") .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_NO_CONTENT); }
Source:
<code>public void registerPostCreationEventConsumer(CircuitBreakerRegistry circuitBreakerRegistry, EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) { eventConsumerRegister = new EventConsumerRegister(eventConsumerRegistry); circuitBreakerRegistry.registerPostCreationConsumer( (circuitBreaker, config) -> eventConsumerRegister.registerEventConsumer(circuitBreaker, config)); <START> } <END></code><technical_language>method reference eventConsumerRegister::registerEventConsumer for readability</technical_language>

Target:
public void registerPostCreationEventConsumer(CircuitBreakerRegistry circuitBreakerRegistry, EventConsumerRegistry<CircuitBreakerEvent> eventConsumerRegistry) { final EventConsumerRegister eventConsumerRegister = new EventConsumerRegister(eventConsumerRegistry); circuitBreakerRegistry.registerPostCreationConsumer(eventConsumerRegister::registerEventConsumer); }
Source:
<code><START> private ArrayList<String> split(String str) { <END> if (str == null || str.isEmpty()) { return null; } return new ArrayList<String>(Arrays.asList(str.split(SEPARATOR))); }</code><technical_language>org.ovirt.engine.core.compat.StringHelper.isNullOrEmpty(String)</technical_language>

Target:
private ArrayList<String> split(String str) { if (StringHelper.isNullOrEmpty(str)) { return null; } return new ArrayList<String>(Arrays.asList(str.split(SEPARATOR))); }
Source:
<code>public GroupDto(Group group) { this.id = group.getId(); this.name = group.getName(); <START> this.users = UserDto.convertToUserDtoList(group.getUsers(), UserDto.BY_NAME_COMPARATOR, DISPLAY_USER_LIMIT); <END> }</code><technical_language>good idea. Group 'Registered users' 40k users retrieved DB. write a hql query retrieve a limited list of users group</technical_language>

Target:
public GroupDto(Group group) { this.id = group.getId(); this.name = group.getName(); }
Source:
<code>public Response getExtensions() { <START> LOG.error("Enumerate is not supported on Server.Please run your operation on prism "); <END> throw FalconWebException.newAPIException("Enumerate is not supported on Server.Please run your operation " + "on prism."); }</code><technical_language>For this, messages fix typos spaces : "Enumerate is supported Server. Please run operation Prism."</technical_language>

Target:
public Response getExtensions() { LOG.error("Enumerate is not supported on Server.Please run your operation on Prism "); throw FalconWebException.newAPIException("Enumerate is not supported on Server. Please run your operation " + "on Prism."); }
Source:
<code>private Iterable<String> quote(List<String> command) { <START> return command.stream().map((String s) -> "\"" + s + "\"").collect(Collectors.toList()); <END> }</code><technical_language>Please format this as: command.stream() .map((String s) -> "\"" + s + "\"") .collect(Collectors.toList());</technical_language>

Target:
private Iterable<String> quote(List<String> command) { return command.stream() .map((String s) -> "\"" + s + "\"") .collect(toImmutableList()); }
Source:
<code>public void run() { try { Log.d(MSG_SERVER_TAG, "Start receiving the msg"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(1024); byte[] buffer = new byte[1024]; int bytesRead; InputStream inputStream = hostThreadSocket.getInputStream(); while ((bytesRead = inputStream.read(buffer)) != -1){ byteArrayOutputStream.write(buffer, 0, bytesRead); <START> msgRec += byteArrayOutputStream.toString("UTF-8"); <END> } Log.d(MSG_SERVER_TAG, "Got msg from client " + msgRec); }catch (IOException e) { e.printStackTrace(); } }</code><technical_language>stringbuilder stringbuffer class, string concatenation is expensive in Java</technical_language>

Target:
public void run() { try { Log.d(MSG_SERVER_TAG, "Start receiving the msg"); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(MAX_MSG_SIZE); byte[] buffer = new byte[MAX_MSG_SIZE]; int bytesRead; InputStream inputStream = hostThreadSocket.getInputStream(); msgRec = new StringBuffer(); bytesRead = inputStream.read(buffer); byteArrayOutputStream.write(buffer, 0, bytesRead); msgRec.append(byteArrayOutputStream.toString("UTF-8")); inputStream.close(); Log.d(MSG_SERVER_TAG, "Got msg from client " + msgRec); if(mMsgRecListenerForThread != null){ mMsgRecListenerForThread.onMessageReceived(msgRec.toString()); }else{ Log.e(MSG_SERVER_TAG, "Message Receiving Listener is not set"); } }catch (IOException e) { e.printStackTrace(); } }
Source:
<code>public void addController(final ServiceController<?> controller) { if (controller == null) return; final ServiceControllerImpl<?> serviceController = (ServiceControllerImpl<?>) controller; synchronized (controllersLock) { while (cleanupInProgress) { <START> try { controllersLock.wait(); } catch (final InterruptedException ignored) <END> } if (controllers.add(serviceController)) { serviceController.addMonitor(this); } } }</code><technical_language>Interruption simply ignored. If thread is interrupted, least, interruption status restored exit. I do this: boolean intr = false; try { .... try { xx.wait(); } catch (InterruptedException ignored) { intr = true; } .... try { xx.wait(); } catch (InterruptedException ignored) { intr = true; } } finally { if (intr) Thread.currentThread().interrupt(); }</technical_language>

Target:
public void addController(final ServiceController<?> controller) { if (controller == null) return; final ServiceControllerImpl<?> serviceController = (ServiceControllerImpl<?>) controller; synchronized (controllersLock) { awaitCleanupCompletion(); if (controllers.add(serviceController)) { serviceController.addMonitor(this); } } }
Source:
<code>private static void validateSymlinkPath(Location location, String attrName, PathFragment symlinkPath, FileTypeSet filetypes, StringBuilder errorsBuilder) throws EvalException { <START> String extensionErrorMessage = "does not have any of the allowed extensions"; <END> if (symlinkPath.isEmpty() || symlinkPath.isAbsolute() || symlinkPath.containsUplevelReferences()) { throw new EvalException( location, String.format("%s must be a relative file path. Got '%s'", attrName, symlinkPath)); } if (!filetypes.matches(symlinkPath.getBaseName())) { errorsBuilder.append( String.format( "'%s' %s %s", symlinkPath, extensionErrorMessage, filetypes)); errorsBuilder.append(LINE_SEPARATOR.value()); } }</code><technical_language>please inline this string</technical_language>

Target:
private static void validateSymlinkPath(Location location, String attrName, PathFragment symlinkPath, FileTypeSet filetypes, StringBuilder errorsBuilder) throws EvalException { if (symlinkPath.isEmpty() || symlinkPath.isAbsolute() || symlinkPath.containsUplevelReferences()) { throw new EvalException( location, String.format("%s must be a relative file path. Got '%s'", attrName, symlinkPath)); } if (!filetypes.matches(symlinkPath.getBaseName())) { errorsBuilder.append( String.format( "'%s' %s %s", symlinkPath, "does not have any of the allowed extensions", filetypes)); errorsBuilder.append(LINE_SEPARATOR.value()); } }
Source:
<code>Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler, Downloader downloader, Cache cache) { DispatcherThread thread = new DispatcherThread(); thread.start(); this.context = context; this.service = service; this.hunterMap = new LinkedHashMap<String, BitmapHunter>(); this.handler = new DispatcherHandler(thread.getLooper()); this.downloader = downloader; this.mainThreadHandler = mainThreadHandler; this.cache = cache; <START> this.batch = new ArrayList<BitmapHunter>(); <END> this.airplaneMode = Utils.isAirplaneModeOn(this.context); NetworkBroadcastReceiver receiver = new NetworkBroadcastReceiver(this.context); receiver.register(); }</code><technical_language>give a default size</technical_language>

Target:
Dispatcher(Context context, ExecutorService service, Handler mainThreadHandler, Downloader downloader, Cache cache) { DispatcherThread thread = new DispatcherThread(); thread.start(); this.context = context; this.service = service; this.hunterMap = new LinkedHashMap<String, BitmapHunter>(); this.handler = new DispatcherHandler(thread.getLooper()); this.downloader = downloader; this.mainThreadHandler = mainThreadHandler; this.cache = cache; this.batch = new ArrayList<BitmapHunter>(4); this.airplaneMode = Utils.isAirplaneModeOn(this.context); NetworkBroadcastReceiver receiver = new NetworkBroadcastReceiver(this.context); receiver.register(); }
Source:
<code>public void givenNestedObjectsDifferentArrayOrder_whenCompared_thenNotEqual() { JsonParser parser = new JsonParser(); String string1 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27, \"consumption_info\" : {\"last_buy\": \"2012-04-23\", \"prouducts\": [\"banana\", \"eggs\"]}}}"; String string2 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27, \"consumption_info\" : {\"last_buy\": \"2012-04-23\", \"prouducts\": [\"eggs\", \"banana\"]}}}"; JsonElement json1 = parser.parse(string1); JsonElement json2 = parser.parse(string2); <START> Assert.assertTrue(json1.isJsonObject()); <END> Assert.assertNotEquals(json1, json2); }</code><technical_language>I need repeatedly assert isJsonObject in tests. one, proved point. for time demonstrated</technical_language>

Target:
public void givenNestedObjectsDifferentArrayOrder_whenCompared_thenNotEqual() { JsonParser parser = new JsonParser(); String string1 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27, \"consumption_info\" : {\"last_buy\": \"2012-04-23\", \"prouducts\": [\"banana\", \"eggs\"]}}}"; String string2 = "{\"customer\": {\"id\": \"44521\",\"fullName\": \"Emily Jenkins\", \"age\": 27, \"consumption_info\" : {\"last_buy\": \"2012-04-23\", \"prouducts\": [\"eggs\", \"banana\"]}}}"; JsonElement json1 = parser.parse(string1); JsonElement json2 = parser.parse(string2); assertNotEquals(json1, json2); }
Source:
<code>public static String formatResponse(GsonProvider gsonProvider, ElasticsearchResponse response) { if ( response == null ) { return null; } JsonObject body = response.getBody(); StringBuilder sb = new StringBuilder( 128 ); sb.append( "Status: " ).append( response.getStatusCode() ).append( " " ).append( response.getStatusMessage() ); sb.append( "\nError message: " ).append( propertyAsString( body, "error" ) ); sb.append( "\nCluster name: " ).append( propertyAsString( body, "cluster_name" ) ); sb.append( "\nCluster status: " ).append( propertyAsString( body, "status" ) ); sb.append( "\n\n" ); JsonElement items = property( body, "items" ); if ( items != null && items.isJsonArray() ) { for ( JsonElement item : items.getAsJsonArray() ) { for ( Map.Entry<String, JsonElement> entry : item.getAsJsonObject().entrySet() ) { sb.append( "Operation: " ).append( entry.getKey() ); JsonElement value = entry.getValue(); sb.append( "\n Index: " ).append( propertyAsString( value, "_index" ) ); sb.append( "\n Type: " ).append( propertyAsString( value, "_type" ) ); sb.append( "\n Id: " ).append( propertyAsString( value, "_id" ) ); sb.append( "\n Status: " ).append( propertyAsString( value, "status" ) ); sb.append( "\n Error: " ).append( propertyAsString( value, "error" ) ) <START> .append( "\n" ); <END> } } } return sb.toString(); }</code><technical_language>indentation is wrong prefix call "sb"</technical_language>

Target:
public static String formatResponse(GsonProvider gsonProvider, ElasticsearchResponse response) { if ( response == null ) { return null; } JsonObject body = response.getBody(); StringBuilder sb = new StringBuilder( 180 ); sb.append( "Status: " ).append( response.getStatusCode() ).append( " " ).append( response.getStatusMessage() ); sb.append( "\nError message: " ).append( propertyAsString( body, "error" ) ); sb.append( "\nCluster name: " ).append( propertyAsString( body, "cluster_name" ) ); sb.append( "\nCluster status: " ).append( propertyAsString( body, "status" ) ); sb.append( "\n\n" ); JsonElement items = property( body, "items" ); if ( items != null && items.isJsonArray() ) { for ( JsonElement item : items.getAsJsonArray() ) { for ( Map.Entry<String, JsonElement> entry : item.getAsJsonObject().entrySet() ) { sb.append( "Operation: " ).append( entry.getKey() ); JsonElement value = entry.getValue(); sb.append( "\n Index: " ).append( propertyAsString( value, "_index" ) ); sb.append( "\n Type: " ).append( propertyAsString( value, "_type" ) ); sb.append( "\n Id: " ).append( propertyAsString( value, "_id" ) ); sb.append( "\n Status: " ).append( propertyAsString( value, "status" ) ); sb.append( "\n Error: " ).append( propertyAsString( value, "error" ) ); sb.append( "\n" ); } } } return sb.toString(); }
Source:
<code>public void do_not_update_rule_with_removed_status() { <START> db.rules().insert(RuleTesting.newRule(RULE_KEY).setStatus(REMOVED)); <END> dbSession.commit(); RuleUpdate update = createForPluginRule(RULE_KEY) .setTags(Sets.newHashSet("java9")) .setOrganization(db.getDefaultOrganization()); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Rule with REMOVED status cannot be updated: squid:S001"); underTest.update(dbSession, update, db.getDefaultOrganization(), userSessionRule); }</code><technical_language>Please consumer, more easily readable : db.rules().insert(rule -> rule.setStatus(REMOVED)</technical_language>

Target:
public void do_not_update_rule_with_removed_status() { db.rules().insert(newRule(RULE_KEY).setStatus(RuleStatus.REMOVED)); dbSession.commit(); RuleUpdate update = createForPluginRule(RULE_KEY) .setTags(Sets.newHashSet("java9")) .setOrganization(db.getDefaultOrganization()); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Rule with REMOVED status cannot be updated: squid:S001"); underTest.update(dbSession, update, db.getDefaultOrganization(), userSessionRule); }
Source:
<code>public void createConnectorInstances(final PersistentObject container, final List<SConnectorDefinition> connectors, final String containerType) throws SBonitaException { final List<SConnectorInstance> connectorInstances = new ArrayList<SConnectorInstance>(connectors.size()); int executionOrder = 0; for (final SConnectorDefinition sConnectorDefinition : connectors) { <START> final int executionOrder1 = executionOrder++; <END> final SConnectorInstance connectorInstance = createConnectorInstanceObject(container, containerType, sConnectorDefinition, executionOrder1); connectorInstances.add(connectorInstance); } final CreateConnectorInstances transaction = new CreateConnectorInstances(connectorInstances, connectorInstanceService); transaction.execute(); }</code><technical_language>executionOrder++ increments use, changes previous behaviour. u this is want</technical_language>

Target:
public void createConnectorInstances(final PersistentObject container, final List<SConnectorDefinition> connectors, final String containerType) throws SBonitaException { final List<SConnectorInstance> connectorInstances = new ArrayList<SConnectorInstance>(connectors.size()); int executionOrder = 0; for (final SConnectorDefinition sConnectorDefinition : connectors) { final SConnectorInstance connectorInstance = createConnectorInstanceObject(container, containerType, sConnectorDefinition, executionOrder++); connectorInstances.add(connectorInstance); } final CreateConnectorInstances transaction = new CreateConnectorInstances(connectorInstances, connectorInstanceService); transaction.execute(); }
Source:
<code>public void connectionDestroyed(final Object connectionID) { if (logger.isTraceEnabled()) { logger.trace("Connection removed " + connectionID + " from server " + this.server, new Exception("trace")); } ConnectionEntry conn = connections.get(connectionID); if (conn != null && !conn.connection.isSupportReconnect()) { RemotingConnection removedConnection = removeConnection(connectionID); if (removedConnection != null) { try { server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDestroyConnection(removedConnection) : null); } catch (Exception e) { <START> throw new IllegalStateException("Error executing afterDestroyConnection plugin method: " + e.getMessage(), e); <END> } } conn.connection.fail(new ActiveMQRemoteDisconnectException()); } }</code><technical_language>here.. I log.warn... interrupt broker if deploys a bugged interceptor.. you</technical_language>

Target:
public void connectionDestroyed(final Object connectionID) { if (logger.isTraceEnabled()) { logger.trace("Connection removed " + connectionID + " from server " + this.server, new Exception("trace")); } ConnectionEntry conn = connections.get(connectionID); if (conn != null && !conn.connection.isSupportReconnect()) { RemotingConnection removedConnection = removeConnection(connectionID); if (removedConnection != null) { try { server.callBrokerPlugins(server.hasBrokerPlugins() ? plugin -> plugin.afterDestroyConnection(removedConnection) : null); } catch (Throwable t) { logger.warn("Error executing afterDestroyConnection plugin method: {}", t.getMessage(), t); } } conn.connection.fail(new ActiveMQRemoteDisconnectException()); } }
Source:
<code>private void move() { ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems(); if (disks == null || getWindow() != null) { return; } MoveDiskModel model = new MoveDiskModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().moveDisksTitle()); model.setHashName("move_disks"); model.setEntity(this); <START> model.setDataCenterId(disks.get(0).getStoragePoolId()); <END> model.init(disks); model.startProgress(null); }</code><technical_language>fine, disks empty</technical_language>

Target:
private void move() { ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems(); if (disks == null || disks.isEmpty() || getWindow() != null) { return; } MoveDiskModel model = new MoveDiskModel(); setWindow(model); model.setTitle(ConstantsManager.getInstance().getConstants().moveDisksTitle()); model.setHashName("move_disks"); model.setEntity(this); model.setDataCenterId(disks.get(0).getStoragePoolId()); model.init(disks); model.startProgress(null); }
Source:
<code>private void createBackButton() { ImageButton goback = (ImageButton) llLayout.findViewById( R.id.backToSentSurveys); goback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> DomainEventPublisher.instance().unSubscribe( <END> createValueSubscriber()); getActivity().onBackPressed(); } } ); }</code><technical_language>if move unsubscribe onDestroy, is necessary invoke</technical_language>

Target:
private void createBackButton() { ImageButton goback = (ImageButton) llLayout.findViewById( R.id.backToSentSurveys); goback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().onBackPressed(); } } ); }
Source:
<code>protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); getCompensationContext().snapshotEntity(vmDevice); vmDeviceDao.update(vmDevice); <START> getCompensationContext().stateChanged(); <END> }</code><technical_language>thanks, please replace order,- stateChanged() vmDevice update call. if a failure calls changes reverted</technical_language>

Target:
protected void updateVmDeviceAddress(final String address, final VmDevice vmDevice) { vmDevice.setAddress(address); getCompensationContext().snapshotEntity(vmDevice); getCompensationContext().stateChanged(); vmDeviceDao.update(vmDevice); }
Source:
<code><START> public TestMessage() { <END> }</code><technical_language>no-arg constructor private</technical_language>

Target:
private TestMessage() { }
Source:
<code>public void testMultipleBlockAddNotify() throws InterruptedException { final int numOfListener = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutInMillisecond = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfListener * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfListener; i++) { <START> final MemoryStoreTestUtils.BlockAddListenerImpl listener <END> = new MemoryStoreTestUtils.BlockAddListenerImpl(countDownLatch, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (blockId * numOfKeysPerBlock); for (int j = 0; j < numOfKeysPerBlock; j++) { final long keyId = keyIdStart + j; data.put(keyId, new Long(keyId)); } memoryStoreImpl.putBlock(blockId, data); } countDownLatch.await(timeoutInMillisecond, TimeUnit.MILLISECONDS); assertEquals(0, countDownLatch.getCount()); }</code><technical_language>a BlockUpdateListener</technical_language>

Target:
public void testMultipleBlockAddNotify() throws InterruptedException { final int numOfListener = 3; final int numOfBlockPut = 10; final int numOfKeysPerBlock = 10; final int timeoutMS = 500; final int blockIdBase = 0x80; final CountDownLatch countDownLatch = new CountDownLatch(numOfListener * numOfBlockPut); final MemoryStoreImpl memoryStoreImpl = (MemoryStoreImpl) memoryStore; for (int i = 0; i < numOfListener; i++) { final BlockUpdateListener listener = new MemoryStoreTestUtils.BlockUpdateListenerImpl(countDownLatch, null, numOfKeysPerBlock); memoryStore.registerBlockUpdateListener(listener); } for (int i = 0; i < numOfBlockPut; i++) { final int blockId = blockIdBase + i; final Map<Long, Object> data = new HashMap<>(); final long keyIdStart = (blockId * numOfKeysPerBlock); for (int keyOffset = 0; keyOffset < numOfKeysPerBlock; keyOffset++) { final long keyId = keyIdStart + keyOffset; data.put(keyId, keyId); } memoryStoreImpl.putBlock(blockId, data); } assertTrue(countDownLatch.await(timeoutMS, TimeUnit.MILLISECONDS)); }
Source:
<code>public void getAndIncrement( String counterName, AsyncCallback<Long> responder ) { try { <START> Invoker.invokeAsync( ATOMIC_MANAGER_SERVER_ALIAS, "getAndIncrement", new Object[] { Backendless.getApplicationId(), Backendless.getVersion(), counterName }, new AtomicCallback( responder ) ); <END> } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }</code><technical_language>sync method for async methods invoke server side prevent duplication code for example getAndIncrement( String counterName, AsyncCallback<Long> responder ) getAndIncrement( String counterName ) invoke server method</technical_language>

Target:
public void getAndIncrement( String counterName, AsyncCallback<Long> responder ) { try { getAndIncrement( counterName ); } catch( Throwable e ) { if( responder != null ) responder.handleFault( new BackendlessFault( e ) ); } }
Source:
<code>public static boolean isValidFormat(String format, String dateAsString) { Date date = null; if (dateAsString != null) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); date = simpleDateFormat.parse(dateAsString); if (!dateAsString.equals(simpleDateFormat.format(date))) { date = null; } } catch (ParseException exception) { OpenMRS.getInstance().getOpenMRSLogger().w("Failed to validate date format :" + dateAsString + " caused by " + exception.toString()); } return date != null; <START> } else { <END> return false; } }</code><technical_language>remove this else block instead set default function return false</technical_language>

Target:
public static boolean isValidFormat(String format, String dateAsString) { Date date = null; if (dateAsString != null) { try { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); date = simpleDateFormat.parse(dateAsString); if (!dateAsString.equals(simpleDateFormat.format(date))) { date = null; } } catch (ParseException exception) { OpenMRS.getInstance().getOpenMRSLogger().w("Failed to validate date format :" + dateAsString + " caused by " + exception.toString()); } return date != null; } return false; }
Source:
<code>public String addNode(Node node, String suggestedId) { nodes.add(node); <START> return null; END> }</code><technical_language>return suggestedId for time being, if reasons this for time ok it</technical_language>

Target:
public String addNode(Node node, String suggestedId) { nodes.add(node); return suggestedId; }
Source:
<code>public boolean saveValue(String key, String value) { if (!isKeyValid(key, "saveValue")) { return false; } if (value == null) { <START> SmartStoreLogger.w(TAG, "saveValue: Invalid value supplied: " + key); <END> return false; } long startNanoTime = System.nanoTime(); try (FileOutputStream f = new FileOutputStream(getFileForKey(key)); EncrypterOutputStream outputStream = new EncrypterOutputStream(f, encryptionKey)) { outputStream.write(value.getBytes(StandardCharsets.UTF_8)); return true; } catch (Exception e) { SmartStoreLogger.e(TAG, "IOException occurred while saving value to filesystem", e); return false; } }</code><technical_language>this value, in this log line? Also, is empty string a valid value? If not, TextUtils.isEmpty(value) a check</technical_language>

Target:
public boolean saveValue(String key, String value) { if (!isKeyValid(key, "saveValue")) { return false; } if (value == null) { SmartStoreLogger.w(TAG, "saveValue: Invalid value supplied: " + value); return false; } long startNanoTime = System.nanoTime(); try (FileOutputStream f = new FileOutputStream(getFileForKey(key)); EncrypterOutputStream outputStream = new EncrypterOutputStream(f, encryptionKey)) { outputStream.write(value.getBytes(StandardCharsets.UTF_8)); return true; } catch (Exception e) { SmartStoreLogger.e(TAG, "IOException occurred while saving value to filesystem", e); return false; } }
Source:
<code>private WebClient createClientForUser(final String id) throws Exception { User u = User.getById(id, true); final ApiTokenProperty t = u.getProperty(ApiTokenProperty.class); final String token = t.getApiTokenInsecure(); WebClient wc = j.createWebClient(); <START> wc.addRequestHeader("Authorization", "Basic " + Scrambler.scramble(id + ":" + token)); <END> return wc; }</code><technical_language>I thought in JenkinsRule.WebClient for this</technical_language>

Target:
private WebClient createClientForUser(final String id) throws Exception { User u = User.getById(id, true); WebClient wc = j.createWebClient(); wc.withBasicApiToken(u); return wc; }