auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); Lfs lfs = new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } <START> in.close(); END> this.in = Files.newInputStream(mediaFile); } }</code><technical_language>do this in try catch ensure close in case some exception is hit</technical_language>

Target:
public SmudgeFilter(Repository db, InputStream in, OutputStream out) throws IOException { super(in, out); try { Lfs lfs = new Lfs(db); LfsPointer res = LfsPointer.parseLfsPointer(in); if (res != null) { AnyLongObjectId oid = res.getOid(); Path mediaFile = lfs.getMediaFile(oid); if (!Files.exists(mediaFile)) { downloadLfsResource(lfs, db, res); } this.in = Files.newInputStream(mediaFile); } } finally { in.close(); } }
Source:
<code>public void testAdd() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(1, 2); setUpGetBallooningExpectations(1, 2); <START> setUpGetConsoleExpectations(new int[]{1,2}); <END> setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, getTemplateEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getVdsGroupEntity()); setUpCreationExpectations(VdcActionType.AddVm, VmManagementParametersBase.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2)); Response response = collection.add(createModel(null)); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 2); }</code><technical_language>removed setUpGetCertuficateExpectations(1, 2);</technical_language>

Target:
public void testAdd() throws Exception { setUriInfo(setUpBasicUriExpectations()); setUpGetPayloadExpectations(1, 2); setUpGetBallooningExpectations(1, 2); setUpGetCertuficateExpectations(1, 2); setUpGetConsoleExpectations(new int[]{1,2}); setUpEntityQueryExpectations(VdcQueryType.GetVmTemplate, GetVmTemplateParameters.class, new String[] { "Id" }, new Object[] { GUIDS[1] }, getTemplateEntity(0)); setUpEntityQueryExpectations(VdcQueryType.GetVdsGroupByVdsGroupId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getVdsGroupEntity()); setUpCreationExpectations(VdcActionType.AddVm, VmManagementParametersBase.class, new String[] { "StorageDomainId" }, new Object[] { GUIDS[0] }, true, true, GUIDS[2], VdcQueryType.GetVmByVmId, IdQueryParameters.class, new String[] { "Id" }, new Object[] { GUIDS[2] }, getEntity(2)); Response response = collection.add(createModel(null)); assertEquals(201, response.getStatus()); assertTrue(response.getEntity() instanceof VM); verifyModel((VM) response.getEntity(), 2); }
Source:
<code>public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } HTNode currentNode = sht.getRootNode(); currentNode.writeInfoFromNode(stateInfo, t); try { while (currentNode.getNodeType() == HTConfig.CORENODE_TYPE) { <START> currentNode = sht.selectNextChild((CoreNode)currentNode, t); <END> currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } return; }</code><technical_language>space cast</technical_language>

Target:
public void doQuery(List<ITmfStateInterval> stateInfo, long t) throws TimeRangeException, StateSystemDisposedException { if (!checkValidTime(t)) { throw new TimeRangeException(); } HTNode currentNode = sht.getRootNode(); currentNode.writeInfoFromNode(stateInfo, t); try { while (currentNode.getNodeType() == HTNode.CORENODE_TYPE) { currentNode = sht.selectNextChild((CoreNode) currentNode, t); currentNode.writeInfoFromNode(stateInfo, t); } } catch (ClosedChannelException e) { throw new StateSystemDisposedException(e); } return; }
Source:
<code>boolean selectCommonAncestor(ReadOnlyDocument doc1, ReadOnlyDocument doc2) <START> throws CouchbaseLiteException { <END> if (!c4doc.getRawDoc().selectCommonAncestorRevision(doc1.getRevID(), doc2.getRevID())) return false; setC4Doc(c4doc); return true; }</code><technical_language>Is CouchbaseLiteException thrown in this method? return void throw CouchbaseLiteException instead</technical_language>

Target:
boolean selectCommonAncestor(ReadOnlyDocument doc1, ReadOnlyDocument doc2) { if (!c4doc.getRawDoc().selectCommonAncestorRevision(doc1.getRevID(), doc2.getRevID())) return false; setC4Doc(c4doc); return true; }
Source:
<code>public void testViewConversationWebhook() throws GeneralException, NotFoundException, UnauthorizedException { <START> ConversationWebhook conversationWebhookResponse = new ConversationWebhook(); <END> conversationWebhookResponse.setId(WHID); conversationWebhookResponse.setUrl(HTTPS_EXAMPLE_COM_WEBHOOKS); conversationWebhookResponse.setChannelId(CHANID); conversationWebhookResponse.setEvents(Collections.singletonList( ConversationWebhookEvent.MESSAGE_CREATED )); when(mockMessageBirdService.requestByID(CONVERSATIONS_WEBHOOK_URL, WHID, ConversationWebhook.class)) .thenReturn(conversationWebhookResponse); ConversationWebhook conversationWebhook = messageBirdClient.viewConversationWebhook(WHID); assertEquals(WHID, conversationWebhook.getId()); assertEquals(HTTPS_EXAMPLE_COM_WEBHOOKS, conversationWebhook.getUrl()); assertEquals(CHANID, conversationWebhook.getChannelId()); assertEquals(1, conversationWebhook.getEvents().size()); assertEquals(ConversationWebhookEvent.MESSAGE_CREATED, conversationWebhook.getEvents().get(0)); }</code><technical_language>create ConversationWebhook in TestUtil class? check other tests, creating objects in TestUtil better</technical_language>

Target:
public void testViewConversationWebhook() throws GeneralException, NotFoundException, UnauthorizedException { ConversationWebhook conversationWebhookResponse = createConversationWebhook(); when(mockMessageBirdService.requestByID(CONVERSATIONS_WEBHOOK_URL, WHID, ConversationWebhook.class)) .thenReturn(conversationWebhookResponse); ConversationWebhook conversationWebhook = messageBirdClient.viewConversationWebhook(WHID); assertEquals(WHID, conversationWebhook.getId()); assertEquals(HTTPS_EXAMPLE_COM_WEBHOOKS, conversationWebhook.getUrl()); assertEquals(CHANID, conversationWebhook.getChannelId()); assertEquals(1, conversationWebhook.getEvents().size()); assertEquals(ConversationWebhookEvent.MESSAGE_CREATED, conversationWebhook.getEvents().get(0)); }
Source:
<code>public void testEqualsAndHashCode() { LongProperty test1 = new LongProperty(TestModel.TABLE, "testCol"); LongProperty test2 = new LongProperty(TestModel.TABLE, "testCol"); assertEquals(test1, test2); assertEquals(test1.hashCode(), test2.hashCode()); StringProperty test3 = new StringProperty(TestModel.TABLE, "testCol"); <START> StringProperty test4 = new StringProperty(TestModel.TABLE, "testCol", "DEFAULT 'A"); <END> assertEquals(test3, test4); assertEquals(test3.hashCode(), test4.hashCode()); Function<Integer> func1 = Function.count(); Function<Integer> func2 = Function.rawFunction("COUNT(*)"); assertEquals(func1, func2); assertEquals(func1.hashCode(), func2.hashCode()); IntegerProperty test5 = Property.IntegerProperty.fromFunction(func1, "count"); IntegerProperty test6 = Property.IntegerProperty.fromFunction(func2, "count"); assertEquals(test5, test6); assertEquals(test5.hashCode(), test6.hashCode()); }</code><technical_language>missing single quote</technical_language>

Target:
public void testEqualsAndHashCode() { LongProperty test1 = new LongProperty(TestModel.TABLE, "testCol"); LongProperty test2 = new LongProperty(TestModel.TABLE, "testCol"); assertEquals(test1, test2); assertEquals(test1.hashCode(), test2.hashCode()); StringProperty test3 = new StringProperty(TestModel.TABLE, "testCol"); StringProperty test4 = new StringProperty(TestModel.TABLE, "testCol", "DEFAULT 'A'"); assertEquals(test3, test4); assertEquals(test3.hashCode(), test4.hashCode()); Function<Integer> func1 = Function.count(); Function<Integer> func2 = Function.rawFunction("COUNT(*)"); assertEquals(func1, func2); assertEquals(func1.hashCode(), func2.hashCode()); IntegerProperty test5 = Property.IntegerProperty.fromFunction(func1, "count"); IntegerProperty test6 = Property.IntegerProperty.fromFunction(func2, "count"); assertEquals(test5, test6); assertEquals(test5.hashCode(), test6.hashCode()); }
Source:
<code>public boolean quotaExceeded(IOException e) { ErrorInfo errorInfo = getErrorInfo(e); <START> if(errorInfo !=null){ <END> return Quota_Exceeded_REASON.equals(errorInfo.getReason()); } return false; }</code><technical_language>Please, format this change google java formatter: <LINK_0></technical_language>

Target:
public boolean quotaExceeded(IOException e) { ErrorInfo errorInfo = getErrorInfo(e); if (errorInfo != null) { return QUOTA_EXCEEDED_REASON.equals(errorInfo.getReason()); } return false; }
Source:
<code><START> public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, <END> final storage_pool storage_pool) { Map<String, String> con = new HashMap<String, String>(); addOrDefault(con, connection.getid(), Guid.Empty.toString(), "id"); addOrEmpty(con, connection.getconnection(), "connection"); addOrEmpty(con, connection.getportal(), "portal"); addOrEmpty(con, connection.getport(), "port"); addOrEmpty(con, connection.getiqn(), "iqn"); addOrEmpty(con, connection.getuser_name(), "user"); addOrEmpty(con, connection.getpassword(), "password"); if (storage_pool != null && Config.<Boolean> GetValue(ConfigValues.AdvancedNFSOptionsEnabled, storage_pool.getcompatibility_version().getValue())) { addIfNotNullOrEmpty(con, connection.getMountOptions(), "mnt_options"); addIfNotNullOrEmpty(con, connection.getVfsType(), "vfs_type"); addOrDefault(con, connection.getNfsVersion(), "auto", "protocol_version"); addIfNotNullOrEmpty(con, connection.getNfsTimeo(), "timeout"); addIfNotNullOrEmpty(con, connection.getNfsRetrans(), "retrans"); } return con; }</code><technical_language>this patch, more sense a 'toHash' method in storage_server_connections ? (and I understand plural form if 1). do I understand properties allowed 'NULL' "" relevant avoid this mucking converting NULL ""</technical_language>

Target:
public static Map<String, String> CreateStructFromConnection(final storage_server_connections connection, final storage_pool storage_pool) { class ConnParamMap extends HashMap<String, String> { void put(String key, Object value, Object def) { put(key, value != null ? value.toString() : def.toString()); } void putIfNotEmpty(String key, Object value) { if (value != null && !"".equals(value.toString())) { put(key, value.toString()); } } }; ConnParamMap con = new ConnParamMap(); con.put("id", connection.getid(), Guid.Empty.toString()); con.put("connection", connection.getconnection(), ""); con.put("portal", connection.getportal(), ""); con.put("port", connection.getport(), ""); con.put("iqn", connection.getiqn(), ""); con.put("user", connection.getuser_name(), ""); con.put("password", connection.getpassword(), ""); if (storage_pool != null && Config.<Boolean> GetValue(ConfigValues.AdvancedNFSOptionsEnabled, storage_pool.getcompatibility_version().getValue())) { con.putIfNotEmpty("mnt_options", connection.getMountOptions()); con.putIfNotEmpty("vfs_type", connection.getVfsType()); con.put("protocol_version", connection.getNfsVersion(), "auto"); con.putIfNotEmpty("timeout", connection.getNfsTimeo()); con.putIfNotEmpty("retrans", connection.getNfsRetrans()); } return con; }
Source:
<code>public int schedule() { <START> schedulingMainLoopTimingLogger = new SchedulingMainLoopTimingLogger(Logger.getLogger(SchedulingMethodImpl.class)); <END> Policy currentPolicy = schedulingService.getPolicy(); activeObjectCreationRetryTimeNumber = ACTIVEOBJECT_CREATION_RETRY_TIME_NUMBER; Map<JobId, JobDescriptor> jobMap = schedulingService.lockJobsToSchedule(); Map<JobId, JobDescriptor> toUnlock = jobMap; logSelectedJobs(jobMap); if (jobMap.isEmpty()) { return 0; } int tasksStarted = startTasks(currentPolicy, jobMap, toUnlock); schedulingMainLoopTimingLogger.printTimingsDEBUGLevel(); return tasksStarted; }</code><technical_language>change mentionned above, new SchedulingMainLoopTimingLogger(logger);</technical_language>

Target:
public int schedule() { schedulingMainLoopTimingLogger = new SchedulingMainLoopTimingLogger(logger); Policy currentPolicy = schedulingService.getPolicy(); activeObjectCreationRetryTimeNumber = ACTIVEOBJECT_CREATION_RETRY_TIME_NUMBER; Map<JobId, JobDescriptor> jobMap = schedulingService.lockJobsToSchedule(); Map<JobId, JobDescriptor> toUnlock = jobMap; logSelectedJobs(jobMap); if (jobMap.isEmpty()) { return 0; } int tasksStarted = startTasks(currentPolicy, jobMap, toUnlock); schedulingMainLoopTimingLogger.printTimingsDEBUGLevel(); return tasksStarted; }
Source:
<code>public void addPartition(TopicPartition topicPartition) { <START> if (!topicPartitions.containsKey(topicPartition)) <END> topicPartitions.put(topicPartition, new TopicPartitionEntry()); }</code><technical_language>nit: putIfAbsent</technical_language>

Target:
private void addPartition(TopicPartition topicPartition) { this.topicPartitions.putIfAbsent(topicPartition, new TopicPartitionEntry()); }
Source:
<code>public ProjectState createEntry(Project.NameKey key) throws Exception { final ReviewDb db = schema.open(); try { final ProjectName pn = db.projectNames().get(key); if (pn == null) { return null; } final Collection<RefRight> rights = Collections.unmodifiableCollection(db.refRights().byProject( pn.getId()).toList()); <START> return projectStateFactory.create(db.projects().get(pn.getId()), rights); <END> } finally { db.close(); } }</code><technical_language>instead of loading database duplicated code, do byId.get(pn.getId()) ? a recursive load byId cache, share ProjectState in memory duplicate it. duplicating logic of construct a ProjectState database</technical_language>

Target:
public ProjectState createEntry(Project.NameKey key) throws Exception { final ReviewDb db = schema.open(); try { final ProjectName pn = db.projectNames().get(key); if (pn == null) { return null; } return byId.get(pn.getId()); } finally { db.close(); } }
Source:
<code>public void run(AccountManagerFuture<Boolean> future) { if (future.isDone()) { Account account = new Account(mAccountName, MainApp.getAccountType()); if (!AccountUtils.exists(account, MainApp.getAppContext())) { <START> mUploaderBinder.cancel(account); <END> mDownloaderBinder.cancel(account); } Account a = AccountUtils.getCurrentOwnCloudAccount(this); String accountName = ""; if (a == null) { Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType()); if (accounts.length != 0) accountName = accounts[0].name; AccountUtils.setCurrentOwnCloudAccount(this, accountName); } addAccountsCheckboxPreferences(); } }</code><technical_language>checking null in binders</technical_language>

Target:
public void run(AccountManagerFuture<Boolean> future) { if (future.isDone()) { Account account = new Account(mAccountName, MainApp.getAccountType()); if (!AccountUtils.exists(account, MainApp.getAppContext())) { if (mUploaderBinder != null) { mUploaderBinder.cancel(account); } if (mDownloaderBinder != null) { mDownloaderBinder.cancel(account); } } Account a = AccountUtils.getCurrentOwnCloudAccount(this); String accountName = ""; if (a == null) { Account[] accounts = AccountManager.get(this).getAccountsByType(MainApp.getAccountType()); if (accounts.length != 0) accountName = accounts[0].name; AccountUtils.setCurrentOwnCloudAccount(this, accountName); } addAccountsCheckboxPreferences(); } }
Source:
<code>public static IStateHistoryBackend createHistoryTreeBackendNewFile(String ssid, File stateFile, int providerVersion, long startTime, int queueSize, Function<ITmfStateInterval, ITmfStateInterval> mapper) throws IOException { if (queueSize > 0) { return new ThreadedHistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, queueSize, mapper); } <START> return new HistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, 64 * 1024, 50); <END> }</code><technical_language>extract 65536 50 please</technical_language>

Target:
public static IStateHistoryBackend createHistoryTreeBackendNewFile(String ssid, File stateFile, int providerVersion, long startTime, int queueSize, Function<ITmfStateInterval, ITmfStateInterval> mapper) throws IOException { if (queueSize > 0) { return new ThreadedHistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, queueSize, mapper); } return new HistoryTreeBackendStub(ssid, stateFile, providerVersion, startTime, BLOCK_SIZE, MAX_CHILDREN); }
Source:
<code>public Boolean getB(ItemMeta cb, ItemStack d) { <START> return cb.isUnbreakable(); <END> }</code><technical_language>I this break compatibility older versions of Spigot. in mind Factions operate versions of Spigot (afaik, 1.7). I recommend a maintain compatibility for example <LINK_0></technical_language>

Target:
public Boolean getB(ItemMeta cb, ItemStack d) { return NmsItemStackMetaUnbreakable.get().isUnbreakable(cb); }
Source:
<code>public Iterable<RelationshipType> getRelationshipTypes() { KernelTransaction transaction = safeAcquireTransaction(); try ( RelationshipTraversalCursor relationships = transaction.cursors().allocateRelationshipTraversalCursor(); Statement ignore = transaction.acquireStatement() ) { NodeCursor nodes = transaction.nodeCursor(); TokenRead tokenRead = transaction.tokenRead(); singleNode( transaction, nodes ); if ( !nodes.next() ) { throw new NotFoundException( "Node not found." ); } nodes.allRelationships( relationships ); List<RelationshipType> types = new ArrayList<>(); while ( relationships.next() ) { types.add( RelationshipType.withName( tokenRead.relationshipTypeName( relationships.label() ) ) ); } return types; } <START> catch ( KernelException e ) <END> { throw new NotFoundException( "Relationship name not found.", e ); } }</code><technical_language>previous implementation returned type once, this return relationship types node relationships</technical_language>

Target:
public Iterable<RelationshipType> getRelationshipTypes() { KernelTransaction transaction = safeAcquireTransaction(); try ( RelationshipTraversalCursor relationships = transaction.cursors().allocateRelationshipTraversalCursor(); Statement ignore = transaction.acquireStatement() ) { NodeCursor nodes = transaction.nodeCursor(); TokenRead tokenRead = transaction.tokenRead(); singleNode( transaction, nodes ); nodes.allRelationships( relationships ); PrimitiveIntSet seen = Primitive.intSet(); List<RelationshipType> types = new ArrayList<>(); while ( relationships.next() ) { int type = relationships.type(); if ( !seen.contains( type ) ) { types.add( RelationshipType.withName( tokenRead.relationshipTypeName( relationships.type() ) ) ); seen.add( type ); } } return types; } catch ( KernelException e ) { throw new NotFoundException( "Relationship name not found.", e ); } }
Source:
<code><START> public TCPClient createTCPClient(final String host, final int port) throws IOException { <END> checkRunning(); return new TCPClient(this, host, port); }</code><technical_language>is key strokes create...haha, seriously, I do this new API tons more</technical_language>

Target:
public TCPClient createTCPClient(final String host, final int port) throws IOException { checkRunning(); TCPClient tc = new TCPClient(this, host, port); clients.put(((Client)tc).getChannel(), tc); return tc; }
Source:
<code>public void setNode(Node selectedNode) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String defaultName = Bundle.TextContentViewerPanel_defaultName(); if (selectedNode == null) { setName(defaultName); } else { Content content = selectedNode.getLookup().lookup(Content.class); if (content != null) { String path = defaultName; try { path = content.getUniquePath(); } catch (TskCoreException ex) { <START> logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for {0}", content); END> } setName(path); } else { setName(defaultName); } } currentNode = selectedNode; setupTabs(selectedNode); } finally { this.setCursor(null); } }</code><technical_language>include exception for debugging purposes</technical_language>

Target:
public void setNode(Node selectedNode) { this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); try { String defaultName = Bundle.TextContentViewerPanel_defaultName(); if (selectedNode == null) { setName(defaultName); } else { Content content = selectedNode.getLookup().lookup(Content.class); if (content != null) { String path = defaultName; try { path = content.getUniquePath(); } catch (TskCoreException ex) { logger.log(Level.SEVERE, "Exception while calling Content.getUniquePath() for " + content.toString(), ex); } setName(path); } else { setName(defaultName); } } currentNode = selectedNode; setupTabs(selectedNode); } finally { this.setCursor(null); } }
Source:
<code>protected void applyFilter(Bundle filterParams) { Log.d(TAG, "applyFilter()"); this.filterParams = filterParams; if (this.filterParams == null) { this.emptyList.setText(R.string.start); String emptyListTitle = this.getString(R.string.start); String title = this.getString(R.string.bbct_title, emptyListTitle); this.getActivity().setTitle(title); } else { this.emptyList.setText(R.string.empty_list); String emptyListTitle = this.getString(R.string.empty_list); String title = this.getString(R.string.bbct_title, emptyListTitle); <START> this.getActivity().setTitle(title); <END> } StringBuilder sb = null; String[] args = null; if (this.filterParams != null) { sb = new StringBuilder(); args = new String[this.filterParams.size()]; int numQueries = 0; for (String key : this.filterParams.keySet()) { String value = this.filterParams.getString(key); switch (key) { case FilterCards.YEAR_EXTRA: sb.append(BaseballCardContract.YEAR_SELECTION); break; case FilterCards.BRAND_EXTRA: sb.append(BaseballCardContract.BRAND_SELECTION); break; case FilterCards.NUMBER_EXTRA: sb.append(BaseballCardContract.NUMBER_SELECTION); break; case FilterCards.PLAYER_NAME_EXTRA: sb.append(BaseballCardContract.PLAYER_NAME_SELECTION); break; case FilterCards.TEAM_EXTRA: sb.append(BaseballCardContract.TEAM_SELECTION); break; default: Log.e(TAG, "Invalid key: " + key); break; } args[numQueries] = value; numQueries++; if (numQueries < args.length) { sb.append(" AND "); } } } Cursor cursor = this .getActivity() .getContentResolver() .query(this.uri, BaseballCardContract.PROJECTION, sb == null ? null : sb.toString(), args, null); this.swapCursor(cursor); }</code><technical_language>R.string.start R.string.empty_list intended for in ListView contains items. This displayed in activity's title. If problems title, find another solution fix it</technical_language>

Target:
protected void applyFilter(Bundle filterParams) { Log.d(TAG, "applyFilter()"); this.filterParams = filterParams; if (this.filterParams == null) { this.emptyList.setText(R.string.start); } else { this.emptyList.setText(R.string.empty_list); } StringBuilder sb = null; String[] args = null; if (this.filterParams != null) { sb = new StringBuilder(); args = new String[this.filterParams.size()]; int numQueries = 0; for (String key : this.filterParams.keySet()) { String value = this.filterParams.getString(key); switch (key) { case FilterCards.YEAR_EXTRA: sb.append(BaseballCardContract.YEAR_SELECTION); break; case FilterCards.BRAND_EXTRA: sb.append(BaseballCardContract.BRAND_SELECTION); break; case FilterCards.NUMBER_EXTRA: sb.append(BaseballCardContract.NUMBER_SELECTION); break; case FilterCards.PLAYER_NAME_EXTRA: sb.append(BaseballCardContract.PLAYER_NAME_SELECTION); break; case FilterCards.TEAM_EXTRA: sb.append(BaseballCardContract.TEAM_SELECTION); break; default: Log.e(TAG, "Invalid key: " + key); break; } args[numQueries] = value; numQueries++; if (numQueries < args.length) { sb.append(" AND "); } } } Cursor cursor = this .getActivity() .getContentResolver() .query(this.uri, BaseballCardContract.PROJECTION, sb == null ? null : sb.toString(), args, null); this.swapCursor(cursor); }
Source:
<code>public IOBlasterResults call() throws Exception { try { rdfRepository.createNamespace(); List<Statement> statements = generateAndInsert(rdfRepository); IOBlasterResults results = queryForAllMatches(rdfRepository, statements); return results; } finally { <START> rdfRepository.deleteNamespace(); <END> } }</code><technical_language>I tend deleting startup clearing shutdown. I suppose trouble is if kill -9 test clean stuck failing time</technical_language>

Target:
public IOBlasterResults call() throws Exception { try { rdfRepository.deleteNamespace(); } catch (ContainedException e) { } rdfRepository.createNamespace(); List<Statement> statements = generateAndInsert(rdfRepository); IOBlasterResults results = queryForAllMatches(rdfRepository, statements); return results; }
Source:
<code>private void doExternalServicesBadInputTest(RestMethod[] restMethods, String expectedExceptionMsg) throws JSONException { for (RestMethod restMethod : restMethods) { if (restMethod.equals(RestMethod.UNKNOWN)) { continue; } JSONObject headers = new JSONObject(); List<ByteBuffer> contents = null; if (restMethod.equals(RestMethod.POST)) { setAmbryHeaders(headers, 1, 7200, false, "doExternalServicesBadInputTest", "application/octet-stream", "doExternalServicesBadInputTest"); <START> contents = new ArrayList<ByteBuffer>(); <END> contents.add(ByteBuffer.allocate(1)); contents.add(null); } try { doOperation(createRestRequest(restMethod, "/", headers, contents), new MockRestResponseChannel()); fail("Operation " + restMethod + " should have failed because an external service would have thrown an exception"); } catch (Exception e) { assertEquals("Unexpected exception message", expectedExceptionMsg, e.getMessage()); } } }</code><technical_language>do need contents here. null right</technical_language>

Target:
private void doExternalServicesBadInputTest(RestMethod[] restMethods, String expectedExceptionMsg) throws JSONException { for (RestMethod restMethod : restMethods) { if (restMethod.equals(RestMethod.UNKNOWN)) { continue; } JSONObject headers = new JSONObject(); List<ByteBuffer> contents = null; if (restMethod.equals(RestMethod.POST)) { setAmbryHeaders(headers, 0, 7200, false, "doExternalServicesBadInputTest", "application/octet-stream", "doExternalServicesBadInputTest"); contents = new ArrayList<ByteBuffer>(1); contents.add(null); } try { doOperation(createRestRequest(restMethod, "/", headers, contents), new MockRestResponseChannel()); fail("Operation " + restMethod + " should have failed because an external service would have thrown an exception"); } catch (Exception e) { assertEquals("Unexpected exception message", expectedExceptionMsg, e.getMessage()); } } }
Source:
<code>public void run() { try { Object containerKey = kms.getKey(blobId.getAccountId(), blobId.getContainerId()); Object perBlobKey = cryptoService.decryptKey(encryptedKey, containerKey); ByteBuffer decryptedBlobContent = null; if (encryptedBlobContent != null) { decryptedBlobContent = cryptoService.decrypt(encryptedBlobContent, perBlobKey); } ByteBuffer decryptedUserMetadata = null; if (encryptedUserMetadata != null) { decryptedUserMetadata = cryptoService.decrypt(encryptedUserMetadata, perBlobKey); } callback.onCompletion(new DecryptJobResult(blobId, decryptedBlobContent, decryptedUserMetadata), null); } catch (Exception e) { <START> callback.onCompletion(new DecryptJobResult(blobId, null, null), e); <END> } }</code><technical_language>callbacks either-or; a result exception. creating a DecryptJobResult for blob ID verification in GetChunk</technical_language>

Target:
public void run() { Exception exception = null; ByteBuffer decryptedBlobContent = null; ByteBuffer decryptedUserMetadata = null; try { Object containerKey = kms.getKey(blobId.getAccountId(), blobId.getContainerId()); Object perBlobKey = cryptoService.decryptKey(encryptedPerBlobKey, containerKey); if (encryptedBlobContent != null) { decryptedBlobContent = cryptoService.decrypt(encryptedBlobContent, perBlobKey); } if (encryptedUserMetadata != null) { decryptedUserMetadata = cryptoService.decrypt(encryptedUserMetadata, perBlobKey); } } catch (Exception e) { exception = e; } finally { callback.onCompletion( exception == null ? new DecryptJobResult(blobId, decryptedBlobContent, decryptedUserMetadata) : null, exception); } }
Source:
<code>private boolean canRestore(SolrClient client, String collection) throws IOException, SolrServerException { <START> LOGGER.trace("Checking restoration capabilitility of collection {}", collection); <END> if (collectionExists(client, collection)) { LOGGER.trace("Collection already exists", collection); if (force) { LOGGER.trace("Force option set, deleting existing collection", collection); CollectionAdminRequest.Delete delete = CollectionAdminRequest.deleteCollection(collection); CollectionAdminResponse response = delete.process(client); return response.isSuccess(); } else { LOGGER.trace("Force option not set, cannot restore collection", collection); return false; } } return true; }</code><technical_language>Typo: capability</technical_language>

Target:
private boolean canRestore(SolrClient client, String collection) throws IOException, SolrServerException { LOGGER.trace("Checking restoration capability of collection {}", collection); if (collectionExists(client, collection)) { LOGGER.trace("Collection already exists", collection); if (force) { LOGGER.trace("Force option set, deleting existing collection", collection); CollectionAdminRequest.Delete delete = CollectionAdminRequest.deleteCollection(collection); CollectionAdminResponse response = delete.process(client); return response.isSuccess(); } else { printErrorMessage( String.format( "Force option not set, cannot restore %s collection. Use --force to restore when the collection exists.", collection)); LOGGER.trace("Force option not set, cannot restore collection", collection); return false; } } return true; }
Source:
<code>public KeyValueCollectionPermission isPermittedMatchAll( CollectionPermission subject, KeyValueCollectionPermission matchAll, KeyValueCollectionPermission allPermissionsCollection) { return isPermitted( <START> new MatchOneCollectionPermission(subject.getPermissionList()), <END> matchAll, allPermissionsCollection); }</code><technical_language>I need wrap this anymore</technical_language>

Target:
public KeyValueCollectionPermission isPermittedMatchAll( CollectionPermission subject, KeyValueCollectionPermission matchAll, KeyValueCollectionPermission allPermissionsCollection) { return isPermitted(subject, matchAll, allPermissionsCollection); }
Source:
<code>protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException { SpecificData data = getSpecificData(); if (data.useCustomCoders()) { <START> Object r = data.newRecord(old, expected); <END> if (r instanceof SpecificRecordBase) { SpecificRecordBase d = (SpecificRecordBase) r; if (d.hasCustomCoders()) { d.customDecode(in); return d; } } } return super.readRecord(old, expected, in); }</code><technical_language>If enable custom coders classes them, silently create spurious instances. a significant performance hit. instead throw exception? Or, if practical, a faster test if a schema a custom coder</technical_language>

Target:
protected Object readRecord(Object old, Schema expected, ResolvingDecoder in) throws IOException { SpecificData data = getSpecificData(); if (data.useCustomCoders()) { old = data.newRecord(old, expected); if (old instanceof SpecificRecordBase) { SpecificRecordBase d = (SpecificRecordBase) old; if (d.hasCustomCoders()) { d.customDecode(in); return d; } } } return super.readRecord(old, expected, in); }
Source:
<code>public void testSuperInterface() { <START> ApexNode<?> node = parse("public interface CustomInterface extends A, B implements C {}"); <END> Assert.assertSame(ASTUserInterface.class, node.getClass()); ASTUserInterface toplevel = (ASTUserInterface) node; Assert.assertEquals("A", toplevel.getSuperInterfaceName()); }</code><technical_language>@rsoesemann is this valid Apex? surprised parsed Jorje</technical_language>

Target:
public void testSuperInterface() { ApexNode<?> node = parse("public interface CustomInterface extends A {}"); Assert.assertSame(ASTUserInterface.class, node.getClass()); ASTUserInterface toplevel = (ASTUserInterface) node; Assert.assertEquals("A", toplevel.getSuperInterfaceName()); }
Source:
<code>private RefactoringStatus checkIfFieldDeclaredIn(final IField iField, final IType type) throws JavaModelException { final IField fieldInType= type.getField(iField.getElementName()); if (!fieldInType.exists()) { return null; } <START> if(!iField.getTypeSignature().equals(fieldInType.getTypeSignature())) { <END> return null; } final String[] keys= { JavaElementLabels.getTextLabel(fieldInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Field_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(fieldInType); return RefactoringStatus.createWarningStatus(msg, context); }</code><technical_language>I merge this 'if' ||</technical_language>

Target:
private RefactoringStatus checkIfFieldDeclaredIn(final IField iField, final IType type) throws JavaModelException { final IField fieldInType= type.getField(iField.getElementName()); if (!fieldInType.exists() || !iField.getTypeSignature().equals(fieldInType.getTypeSignature())) { return null; } final String[] keys= { JavaElementLabels.getTextLabel(fieldInType, JavaElementLabels.ALL_FULLY_QUALIFIED), JavaElementLabels.getTextLabel(type, JavaElementLabels.ALL_FULLY_QUALIFIED)}; final String msg= Messages.format(RefactoringCoreMessages.PullUpRefactoring_Field_declared_in_class, keys); final RefactoringStatusContext context= JavaStatusContext.create(fieldInType); return RefactoringStatus.createWarningStatus(msg, context); }
Source:
<code>private void cleanupMountTable(Date cutoff) { List<Long> purgeInstanceIds = create() .select(INSTANCE.ID) .from(INSTANCE) .where(INSTANCE.STATE.eq("purged")) .fetch().into(Long.class); List<Long> localOrHostBindMountVolumeIds = create() .select(VOLUME.ID) .from(VOLUME) .where(VOLUME.DATA.like("%\"isHostPath\":true%")) .or(VOLUME.DATA.like("%\"driver\":\"local\"%")) .fetch().into(Long.class); <START> ResultQuery<Record1<Long>> ids = create() <END> .select(MOUNT.ID) .from(MOUNT) .where(MOUNT.INSTANCE_ID.in(purgeInstanceIds)) .and(MOUNT.VOLUME_ID.in(localOrHostBindMountVolumeIds)) .and(MOUNT.STATE.eq("inactive")); List<Long> toDelete = null; int rowsDeleted = 0; while ((toDelete = ids.fetch().into(Long.class)).size() > 0) { rowsDeleted += create().delete(MOUNT) .where(MOUNT.ID.in(toDelete)).execute(); } if (rowsDeleted > 0) { log.info("[Rows Deleted] mount={}", rowsDeleted); } }</code><technical_language>QUERY_LIMIT_ROWS put this query in a loop limiting number of mounts deleting in statement</technical_language>

Target:
private void cleanupMountTable(Date cutoff) { List<Long> purgeInstanceIds = create() .select(INSTANCE.ID) .from(INSTANCE) .where(INSTANCE.STATE.eq(CommonStatesConstants.PURGED)) .fetch().into(Long.class); List<Long> localOrHostBindMountVolumeIds = create() .select(VOLUME.ID) .from(VOLUME) .where(VOLUME.DATA.like("%\"isHostPath\":true%")) .or(VOLUME.DATA.like("%\"driver\":\"local\"%")) .fetch().into(Long.class); ResultQuery<Record1<Long>> ids = create() .select(MOUNT.ID) .from(MOUNT) .where(MOUNT.INSTANCE_ID.in(purgeInstanceIds)) .and(MOUNT.VOLUME_ID.in(localOrHostBindMountVolumeIds)) .and(MOUNT.STATE.eq("inactive")) .limit(QUERY_LIMIT_ROWS.getValue()); List<Long> toDelete = null; int rowsDeleted = 0; while ((toDelete = ids.fetch().into(Long.class)).size() > 0) { rowsDeleted += create().delete(MOUNT) .where(MOUNT.ID.in(toDelete)).execute(); } if (rowsDeleted > 0) { log.info("[Rows Deleted] mount={}", rowsDeleted); } }
Source:
<code>public void visit(SystemStreamPartition systemStreamPartition, StartpointUpcoming startpointUpcoming) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Collection<TopicPartition> topicPartitions = ImmutableList.of(topicPartition); LOG.info("Seeking the kafka consumer to the end offset for the topic partition: {}.", topicPartitions); kafkaConsumer.seekToEnd(topicPartitions); <START> } <END></code><technical_language>please change name is responsible for startpoint registration? "StartpointVisitor" needs act a Startpoint, KafkaStartpointVisitor specific enough</technical_language>

Target:
public void visit(SystemStreamPartition systemStreamPartition, StartpointUpcoming startpointUpcoming) { TopicPartition topicPartition = toTopicPartition(systemStreamPartition); Collection<TopicPartition> topicPartitions = ImmutableList.of(topicPartition); LOG.info("Seeking the kafka consumer to the end offset for the topic partition: {}.", topicPartitions); synchronized (kafkaConsumer) { kafkaConsumer.seekToEnd(topicPartitions); } }
Source:
<code>public String internalException(String marker) { return "Huch? Warum funktioniert das nicht? Das war bestimmt dein Fehler!" <START> + " Falls dies weiterhin vorkommt leite folgendes an [<LINK_0> @Tillerinobot] oder [<LINK_1> /u/Tillerino]weiter: "+ marker + "."; <END> }</code><technical_language>vorkommt, leite (Komma) > Tillerino] weiter (Leerzeichen) This sentence a bit formal</technical_language>

Target:
public String internalException(String marker) { return "Huch? Warum funktioniert das nicht? Das war bestimmt dein Fehler!" + " Falls dies weiterhin vorkommt, leite folgendes an [<LINK_0> @Tillerinobot] oder [<LINK_1> /u/Tillerino] weiter: "+ marker + "."; }
Source:
<code>public GuidePostsInfo(long byteCount, ImmutableBytesWritable guidePosts, long rowCount, int maxLength, int guidePostsCount) { <START> this.guidePosts = guidePosts; <END> this.maxLength = maxLength; this.byteCount = byteCount; this.rowCount = rowCount; this.guidePostsCount = guidePostsCount; lastRow = ByteUtil.EMPTY_BYTE_ARRAY; }</code><technical_language>a copy of ImmutableBytesWritable in case caller ptr again. Note this copy underlying bytes: this.guidePosts = new ImmutableBytesWritable(guidePosts);</technical_language>

Target:
public GuidePostsInfo(long byteCount, ImmutableBytesWritable guidePosts, long rowCount, int maxLength, int guidePostsCount) { this.guidePosts = new ImmutableBytesWritable(guidePosts); this.maxLength = maxLength; this.byteCount = byteCount; this.rowCount = rowCount; this.guidePostsCount = guidePostsCount; }
Source:
<code>protected void executeVdsBrokerCommand() { <START> status = <END> getBroker().glusterMetaVolumeMount(); proceedProxyReturnValue(); }</code><technical_language>name of meta-volume a parameter vdsm</technical_language>

Target:
protected void executeVdsBrokerCommand() { status = getBroker().glusterMetaVolumeMount(Config.<String> getValue(ConfigValues.GlusterMetaVolumeName)); proceedProxyReturnValue(); }
Source:
<code>private void createDiskBasedOnLun() { final LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { <START> boolean shouldPlugDisk = getVm().getStatus() == VMStatus.Down && (getParameters().getPlugDiskToVm() == null || getParameters().getPlugDiskToVm()); <END> VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldPlugDisk, Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null); } return null; } }); getReturnValue().setActionReturnValue(getParameters().getDiskInfo().getId()); plugDiskToVmIfNeeded(); setSucceeded(true); }</code><technical_language>This a wrong - plug if vm is down. this: Boolean plugParam = getParameters().getPlugDiskToVm()); boolean shouldPlugDisk = Boolean.TRUE.equals(plugParam) || (plugParam == null && getVm().getStatus() == VMStatus.Down);</technical_language>

Target:
private void createDiskBasedOnLun() { final LUNs lun = ((LunDisk) getParameters().getDiskInfo()).getLun(); TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { @Override public Void runInTransaction() { StorageDomainCommandBase.proceedLUNInDb(lun, lun.getLunType()); getBaseDiskDao().save(getParameters().getDiskInfo()); getDiskLunMapDao().save(new DiskLunMap(getParameters().getDiskInfo().getId(), lun.getLUN_id())); if (getVm() != null) { VmDeviceUtils.addManagedDevice(new VmDeviceId(getParameters().getDiskInfo().getId(), getVmId()), VmDeviceGeneralType.DISK, VmDeviceType.DISK, null, shouldDiskBePlugged(), Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()), null); } return null; } }); getReturnValue().setActionReturnValue(getParameters().getDiskInfo().getId()); plugDiskToVmIfNeeded(); setSucceeded(true); }
Source:
<code>public @ResponseBody String availableInternalUnits(final @RequestParam(required = false, value = "term") String term, final Model model) { final JsonArray result = new JsonArray(); final String trimmedValue = term.trim(); final String[] input = StringNormalizer.normalize(trimmedValue).split(" "); final SapStructure sapStructure = new SapStructure(); final JsonObject sapInput = new JsonObject(); <START> sapInput.addProperty("institution", SapSdkConfiguration.getConfiguration().sapServiceInstitutionCode()); <END> for (final JsonElement pepElement : sapStructure.listSanitizedProjects(sapInput)) { final JsonObject pepObject = pepElement.getAsJsonObject(); final String pepUnitSapId = getString(pepObject, "unitSapId"); final JsonObject o = new JsonObject(); o.addProperty("id", pepUnitSapId); o.addProperty("name", pepUnitSapId); result.add(o); } return result.toString(); }</code><technical_language>missing trimmedValue usage</technical_language>

Target:
public @ResponseBody String availableInternalUnits(final @RequestParam(required = false, value = "term") String term, final Model model) { final JsonArray result = new JsonArray(); final String trimmedValue = term.trim(); final String[] input = StringNormalizer.normalize(trimmedValue).split(" "); final SapStructure sapStructure = new SapStructure(); final JsonObject sapInput = new JsonObject(); sapInput.addProperty("institution", SapSdkConfiguration.getConfiguration().sapServiceInstitutionCode()); for (final JsonElement pepElement : sapStructure.listSanitizedProjects(sapInput)) { final JsonObject pepObject = pepElement.getAsJsonObject(); final String pepUnitSapId = getString(pepObject, "unitSapId"); if (matches(input, pepUnitSapId)) { final JsonObject o = new JsonObject(); o.addProperty("id", pepUnitSapId); o.addProperty("name", pepUnitSapId); result.add(o); } } return result.toString(); }
Source:
<code>public static String getSoundDevice(VmBase vm, Version compatibilityVersion) { final String OS_REGEX = "^.*%1s,([^,]*).*$"; final String DEFAULT_TYPE = "default"; String ret = DEFAULT_TYPE; if (vm.getvm_type() == VmType.Desktop) { String soundDeviceTypeConfig = Config.<String> GetValue( <START> ConfigValues.DesktopAudioDeviceType); <END> String vmOS = vm.getos().name(); Pattern regexPattern = Pattern.compile(String .format(OS_REGEX, vmOS)); Matcher regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } else { regexPattern = Pattern.compile(String.format(OS_REGEX, DEFAULT_TYPE)); regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } } } return ret; }</code><technical_language>removing compatibility version deal some OSs relevant for newer cluster levels</technical_language>

Target:
public static String getSoundDevice(VmBase vm, Version compatibilityVersion) { final String OS_REGEX = "^.*%1s,([^,]*).*$"; final String DEFAULT_TYPE = "default"; String ret = DEFAULT_TYPE; if (vm.getvm_type() == VmType.Desktop) { String soundDeviceTypeConfig = Config.<String> GetValue( ConfigValues.DesktopAudioDeviceType, compatibilityVersion.toString()); String vmOS = vm.getos().name(); Pattern regexPattern = Pattern.compile(String .format(OS_REGEX, vmOS)); Matcher regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } else { regexPattern = Pattern.compile(String.format(OS_REGEX, DEFAULT_TYPE)); regexMatcher = regexPattern.matcher(soundDeviceTypeConfig); if (regexMatcher.find()) { ret = regexMatcher.group(1); } } } return ret; }
Source:
<code>public void initialize() throws ParseException { final List<Row> rows = dataParser.get(); try { final List<Long> ids = dataIdFactory.getIds(rows.size()); <START> workloadQuota.register(dataType, ids.get(0), ids.get(ids.size() - 1)); <END> partitionTracker.registerPartition(dataType, ids.get(0), ids.get(ids.size() - 1)); memoryStore.getElasticStore().putList(dataType, ids, rows); } catch (final IdGenerationException e) { throw new RuntimeException(e); } }</code><technical_language>I this assumes registerPartition fails, I workload assigned data is put in MemoryStore successfully</technical_language>

Target:
public void initialize() throws ParseException { final List<Row> rows = dataParser.get(); try { final List<Long> ids = dataIdFactory.getIds(rows.size()); final Map<String, Set<LongRange>> workloadMap = new HashMap<>(); final Set<LongRange> rangeSet = new HashSet<>(); rangeSet.add(new LongRange(ids.get(0).longValue(), ids.size() - 1)); workloadMap.put(dataType, rangeSet); workloadPartition.initialize(workloadMap); partitionTracker.registerPartition(dataType, ids.get(0), ids.get(ids.size() - 1)); memoryStore.getElasticStore().putList(dataType, ids, rows); } catch (final IdGenerationException e) { throw new RuntimeException(e); } }
Source:
<code>public Response startMonitor( @PathParam("id") int id, @QueryParam("clientId") String clientId, @DefaultValue("10") @QueryParam("updateInterval") int updateInterval) { currentTimestamp = System.currentTimeMillis(); Session session = GTFSDB.initSessionBeginTrans(); GtfsRtFeedModel gtfsRtFeed = (GtfsRtFeedModel) session.createQuery(" FROM GtfsRtFeedModel " + "WHERE rtFeedID = "+id).uniqueResult(); SessionModel feedSession = null; List<SessionModel> sessionModelList = (List<SessionModel>) session.createQuery( " select sm FROM SessionModel sm inner join sm.gtfsRtFeedModel as gm " + " WHERE gm.gtfsRtId = " + id + " AND sm.sessionStartTime > " + (currentTimestamp - (15 * 60 * 1000)) + " ORDER BY sm.sessionStartTime DESC").list(); if(sessionModelList != null && sessionModelList.size() > 0) { feedSession = sessionModelList.get(0); } SessionModel sessionModel = new SessionModel(); sessionModel.setClientId(clientId); sessionModel.setSessionStartTime(currentTimestamp); sessionModel.setGtfsRtFeedModel(gtfsRtFeed); session.save(sessionModel); GTFSDB.commitAndCloseSession(session); <START> if(feedSession == null) { <END> _log.info("No feed session, starting new one!"); startBackgroundTask(gtfsRtFeed, updateInterval); } else{ _log.info("Feed session found!"); } return Response.ok(sessionModel, MediaType.APPLICATION_JSON).build(); }</code><technical_language>So I guess simply passing startTime is necessary change? (the I in monitoring.js file) Yes, I this is primary improvement in this PR - if remove other changes great (modulo v1.0.1). However, convinced this fixes #215. @Suryakandukoori dig in a more merging this PR, tied some other tasks this week</technical_language>

Target:
public Response startMonitor( @PathParam("id") int id, @QueryParam("clientId") String clientId, @DefaultValue("10") @QueryParam("updateInterval") int updateInterval) { currentTimestamp = System.currentTimeMillis(); Session session = GTFSDB.initSessionBeginTrans(); GtfsRtFeedModel gtfsRtFeed = (GtfsRtFeedModel) session.createQuery(" FROM GtfsRtFeedModel " + "WHERE rtFeedID = "+id).uniqueResult(); SessionModel sessionModel = new SessionModel(); sessionModel.setClientId(clientId); sessionModel.setSessionStartTime(currentTimestamp); sessionModel.setGtfsRtFeedModel(gtfsRtFeed); session.save(sessionModel); GTFSDB.commitAndCloseSession(session); startBackgroundTask(gtfsRtFeed, updateInterval); return Response.ok(sessionModel, MediaType.APPLICATION_JSON).build(); }