auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public OauthAuthenticationResult authenticate(HttpServletRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest cannot be null."); Class httpRequestClass = httpRequest.getClass(); if (HttpServletRequest.class.isAssignableFrom(httpRequestClass)) { <START> this.httpServletRequest = (HttpServletRequest) httpRequest; <END> } else { throw new IllegalArgumentException(String.format(HTTP_REQUEST_NOT_SUPPORTED_MSG, httpRequest.getClass(), HttpServletRequest.class.getName())); } OauthAuthenticationRequestFactory factory = new OauthAuthenticationRequestFactory(); AuthenticationRequest request = factory.createFrom(httpServletRequest); AuthenticationResult result = application.authenticateAccount(request); Assert.isInstanceOf(OauthAuthenticationResult.class, result); return (OauthAuthenticationResult) result; }</code><technical_language>cast HttpServletRequest is required</technical_language>

Target:
public OauthAuthenticationResult authenticate(HttpServletRequest httpRequest) { Assert.notNull(httpRequest, "httpRequest cannot be null."); Class httpRequestClass = httpRequest.getClass(); if (HttpServletRequest.class.isAssignableFrom(httpRequestClass)) { this.httpServletRequest = httpRequest; } else { throw new IllegalArgumentException(String.format(HTTP_REQUEST_NOT_SUPPORTED_MSG, httpRequest.getClass(), HttpServletRequest.class.getName())); } OauthAuthenticationRequestFactory factory = new OauthAuthenticationRequestFactory(); AuthenticationRequest request = factory.createFrom(httpServletRequest); AuthenticationResult result = application.authenticateAccount(request); Assert.isInstanceOf(OauthAuthenticationResult.class, result); return (OauthAuthenticationResult) result; }
Source:
<code>private List<RepoProject> getBareProjects(List<RepoProject> projects) { assert (repo.isBare()); <START> Map<String, List<RepoProject>> m = new HashMap<>(); <END> for (RepoProject proj : projects) { if (m.containsKey(proj.getName())) { m.get(proj.getName()).add(proj); } else { List<RepoProject> l = new ArrayList<>(); l.add(proj); m.put(proj.getName(), l); } } List<RepoProject> ret = new ArrayList<>(); for (Entry<String, List<RepoProject>> e : m.entrySet()) { boolean suffixWithPath = e.getValue().size() != 1; for (RepoProject proj : e.getValue()) { String name = proj.getName(); if (suffixWithPath) { name += SLASH + proj.getPath(); } RepoProject bareProj = new RepoProject(name, proj.getPath(), proj.getRevision(), null, proj.getGroups(), proj.getRecommendShallow()); bareProj.setUrl(proj.getUrl()); bareProj.addCopyFiles(proj.getCopyFiles()); bareProj.addLinkFiles(proj.getLinkFiles()); ret.add(bareProj); } } return ret; }</code><technical_language>note self: Multimap is a guava type, part of standard library, need roll own</technical_language>

Target:
private List<RepoProject> getBareProjects(List<RepoProject> projects) { assert (repo.isBare()); Map<String, List<RepoProject>> m = new HashMap<>(); for (RepoProject proj : projects) { List<RepoProject> l = m.get(proj.getName()); if (l == null) { l = new ArrayList<>(); m.put(proj.getName(), l); } l.add(proj); } List<RepoProject> ret = new ArrayList<>(); for (List<RepoProject> ps : m.values()) { boolean nameConflict = ps.size() != 1; for (RepoProject proj : ps) { String name = proj.getName(); if (nameConflict) { name += SLASH + proj.getPath(); } RepoProject bareProj = new RepoProject(name, proj.getPath(), proj.getRevision(), null, proj.getGroups(), proj.getRecommendShallow()); bareProj.setUrl(proj.getUrl()); bareProj.addCopyFiles(proj.getCopyFiles()); bareProj.addLinkFiles(proj.getLinkFiles()); ret.add(bareProj); } } return ret; }
Source:
<code>public Tuple2<Integer, String> cross( Tuple5<Integer, Long, Integer, String, Long> first, Tuple5<Integer, Long, Integer, String, Long> second) throws Exception { <START> if(first.f0 < 3 && second.f0 < 3) <END> return new Tuple2<Integer, String>(first.f2+second.f2, first.f3+second.f3); return new Tuple2<Integer, String>(1,"test"); }</code><technical_language>Is this condition false in tests</technical_language>

Target:
public Tuple2<Integer, String> cross( Tuple5<Integer, Long, Integer, String, Long> first, Tuple5<Integer, Long, Integer, String, Long> second) throws Exception { return new Tuple2<Integer, String>(first.f2+second.f2, first.f3+second.f3); }
Source:
<code>public Date getStartDate() { <START> return new Date(startDate.getTime()); <END> }</code><technical_language>@ribhavsharma please a [this](<LINK_0> clone() method while returning fix travis-ci build failure :)</technical_language>

Target:
public Date getStartDate() { return return (Date) endDate.clone(); }
Source:
<code>public static boolean isDescendant(File forParent, File potentialChild) throws IOException { <START> Path child = potentialChild.getAbsoluteFile().toPath(); <END> Path parent = forParent.getAbsoluteFile().toPath(); return child.startsWith(parent); }</code><technical_language>getAbsoluteFile() need return canonical file, get false negatives... OTOH canonical file resolving is a more time costly operation</technical_language>

Target:
public static boolean isDescendant(File forParent, File potentialChild) throws IOException { try { Path child = potentialChild.getAbsoluteFile().toPath().normalize(); Path parent = forParent.getAbsoluteFile().toPath().normalize(); return child.startsWith(parent); } catch (InvalidPathException e) { throw new IOException(e); } }
Source:
<code>public Class<?> defineClass(String name, byte[] bytes) { Class<?> ret = defined.get(name.replace('/', '.')); if (ret != null) { return ret; } if (name.endsWith("package-info")) { Package p = super.getPackage(name.substring(0, name.length() - 13)); if (p == null) { definePackage(name.substring(0, name.length() - 13).replace('/', '.'), null, null, null, null, null, null, null); } } ret = super.defineClass(name.replace('/', '.'), bytes, 0, bytes.length); <START> Class<?> tmpRet = defined.putIfAbsent(name.replace('/', '.'), ret); <END> if (tmpRet != null) { ret = tmpRet; } return ret; }</code><technical_language>Minor, computeIfAbsent a bit more helpful (may eliminate some calls super.defineClass)</technical_language>

Target:
public Class<?> defineClass(String name, byte[] bytes) { Class<?> ret = defined.get(StringUtils.slashesToPeriod(name)); if (ret != null) { return ret; } if (name.endsWith("package-info")) { String s = name.substring(0, name.length() - 13); Package p = super.getPackage(s); if (p == null) { definePackage(StringUtils.slashesToPeriod(s), null, null, null, null, null, null, null); } } ret = defined.computeIfAbsent(StringUtils.slashesToPeriod(name), key -> TypeHelperClassLoader.super.defineClass(key, bytes, 0, bytes.length)); return ret; }
Source:
<code>public void execute() { <START> <END> SaveDatabaseAction saveDatabaseAction = SaveDatabaseAction.create(frame.getCurrentBasePanel(), Globals.prefs, Globals.entryTypesManager); switch (saveMethod) { case SAVE: saveDatabaseAction.save(); break; case SAVE_AS: saveDatabaseAction.saveAs(); break; case SAVE_SELECTED: saveDatabaseAction.saveSelectedAsPlain(); break; default: } }</code><technical_language>remove empty line</technical_language>

Target:
public void execute() { SaveDatabaseAction saveDatabaseAction = new SaveDatabaseAction( frame.getCurrentLibraryTab(), Globals.prefs, Globals.entryTypesManager); switch (saveMethod) { case SAVE -> saveDatabaseAction.save(); case SAVE_AS -> saveDatabaseAction.saveAs(); case SAVE_SELECTED -> saveDatabaseAction.saveSelectedAsPlain(); } }
Source:
<code>public FileInfo[] listDir() { if( !exists() ) return new FileInfo[] {}; if( !isDirectory() ) return new FileInfo[] { this }; ArrayList<FileInfo> res = new ArrayList<>(); try { RemoteIterator<LocatedFileStatus> iterator = fs.listLocatedStatus(path); while (iterator.hasNext()) { res.add( new HFileInfo(iterator.next()) ); } } catch (IOException e) { <START> return new FileInfo[0]; <END> } return res.toArray(new FileInfo[res.size()]); }</code><technical_language>log exception (or re-throw it)? user directory empty in reality e.g. connect</technical_language>

Target:
public FileInfo[] listDir() throws IOException { if( !exists() ) return new FileInfo[] {}; if( !isDirectory() ) return new FileInfo[] { this }; List<FileInfo> res = new ArrayList<>(); RemoteIterator<LocatedFileStatus> iterator = fs.listLocatedStatus(path); while (iterator.hasNext()) { res.add( new HFileInfo(iterator.next()) ); } return res.toArray(new FileInfo[res.size()]); }
Source:
<code>public RequestStats() { <START> allResponse = new CounterStat(); <END> informationalResponse = new CounterStat(); successfulResponse = new CounterStat(); redirectionResponse = new CounterStat(); clientErrorResponse = new CounterStat(); serverErrorResponse = new CounterStat(); requestFailed = new CounterStat(); requestCanceled = new CounterStat(); requestTime = new TimeStat(); responseTime = new TimeStat(); readBytes = new DistributionStat(); writtenBytes = new DistributionStat(); }</code><technical_language>in field declaration</technical_language>

Target:
public RequestStats() { }
Source:
<code>public int countDownBricks(GlusterVolumeEntity volume) { int downCount = 0; int upCount = 0; <START> for (int i = 0 ; i < volume.getBricks().size(); i++) { <END> GlusterBrickEntity brick = volume.getBricks().get(i); if(brick.getStatus() == GlusterStatus.UP) { upCount++; }else { downCount++; } if(upCount > 0 && downCount > 0) { return downCount; } } return downCount; }</code><technical_language>foreach style loop</technical_language>

Target:
public int countDownBricks(GlusterVolumeEntity volume) { int downCount = 0; int upCount = 0; for (GlusterBrickEntity brick : volume.getBricks()) { if (brick.getStatus() == GlusterStatus.UP) { upCount++; } else { downCount++; } if (upCount > 0 && downCount > 0) { return downCount; } } return downCount; }
Source:
<code>public static ArgumentBuilder<CommandSource, ?> register(String name, ITreeSpawner treeSpawner) { return Commands.literal(name).requires(PermLevel.ADMIN) <START> .then(Commands.argument("type", EnumArgument.enumArgument(TreeDefinition.class)) <END> .executes(a -> run(treeSpawner, a.getSource(), a.getArgument("type", TreeDefinition.class)))) .executes(a -> run(treeSpawner, a.getSource(), TreeDefinition.Oak)); }</code><technical_language>trees other mods</technical_language>

Target:
public static ArgumentBuilder<CommandSource, ?> register(String name, ITreeSpawner treeSpawner) { return Commands.literal(name).requires(PermLevel.ADMIN) .then(Commands.argument("type", TreeArugment.treeArgument()) .executes(a -> run(treeSpawner, a.getSource(), a.getArgument("type", ITree.class)))) .executes(a -> run(treeSpawner, a.getSource(), TreeDefinition.Oak.createIndividual())); }
Source:
<code>protected Result check() throws Exception { String entity = "test"; String version = "1.0.0"; String request = getFindTestRequest(entity, version); RequestMetrics metrics = new DropwizardRequestMetrics(MetricRegistryFactory.getJmxMetricRegistry()); CallStatus callStatus = new FindCommand(entity, version, request, metrics).run(); if(callStatus.hasErrors()){ return Result.unhealthy("Reads are not healthy: " + callStatus.getErrors()); } <START> return Result.healthy(); <END> }</code><technical_language>I this needs update for details (could put query response read json (callStatus.toJson())</technical_language>

Target:
protected Result check() throws Exception { String entity = "test"; String version = "1.0.0"; String request = getFindTestRequest(entity, version); RequestMetrics metrics = new DropwizardRequestMetrics(MetricRegistryFactory.getJmxMetricRegistry()); CallStatus callStatus = new FindCommand(entity, version, request, metrics).run(); ResultBuilder resultBuilder; if (Response.Status.OK.equals(callStatus.getHttpStatus())) { resultBuilder = Result.builder().healthy(); } else { resultBuilder = Result.builder().unhealthy().withMessage("Reads are not healthy"); } resultBuilder.withDetail("readResponse", callStatus.getReturnValue().toJson()); return resultBuilder.build(); }
Source:
<code>private void overrideBlobName(Exchange exchange) { String blobName = exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, String.class); <START> if (StringUtils.isNotEmpty(blobName)) { <END> getEndpoint().getConfiguration().setBlobName(blobName); } }</code><technical_language>Camel's ObjectHelper - org.apache.camel.util.ObjectHelper#isNotEmpty</technical_language>

Target:
private void overrideBlobName(Exchange exchange) { String blobName = exchange.getIn().getHeader(OVERRIDE_BLOB_NAME, String.class); if (ObjectHelper.isNotEmpty(blobName)) { getEndpoint().getConfiguration().setBlobName(blobName); } }
Source:
<code>private boolean isQuarriableBlock(int bx, int by, int bz) { Block block = worldObj.getBlock(bx, by, bz); <START> return !BlockUtil.canChangeBlock(block, worldObj, bx, by, bz) || <END> BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz) || (block.getBlockHardness(worldObj, bx, by, bz) > MAX_BREAK_HARDNESS); }</code><technical_language>I in this lines a logical rubbish</technical_language>

Target:
private boolean isQuarriableBlock(int bx, int by, int bz) { Block block = worldObj.getBlock(bx, by, bz); return BlockUtil.canChangeBlock(block, worldObj, bx, by, bz) && !BuildCraftAPI.isSoftBlock(block, worldObj, bx, by, bz) && (block.getBlockHardness(worldObj, bx, by, bz) < MAX_BREAK_HARDNESS); }
Source:
<code>public static TransactionManager getTransactionManager() throws Exception { long key = Thread.currentThread().getId(); try { if (log.isDebugEnabled()) { log.debug("beginTransaction()"); } TransactionManager txMgr = txManagers.get().get(key); return txMgr; } catch (Exception ex) { <START> log.debug(" BEGIN ERROR : " + txManagers.get().get(key).getStatus()); <END> throw ex; } }</code><technical_language>this is error log ( log.error(...) )</technical_language>

Target:
public static TransactionManager getTransactionManager() throws Exception { long key = Thread.currentThread().getId(); try { if (log.isDebugEnabled()) { log.debug("getTransactionManager Called"); } TransactionManager txMgr = txManagers.get().get(key); return txMgr; } catch (Exception ex) { log.error(" BEGIN ERROR : " + txManagers.get().get(key).getStatus()); throw ex; } }
Source:
<code>private static QueryStatusEncoding queryStatusHelper(final SQLiteStatement statement) throws SQLiteException { final QueryStatusEncoding queryStatus = new QueryStatusEncoding(statement.columnLong(0)); queryStatus.rawQuery = statement.columnString(1); queryStatus.logicalRa = statement.columnString(2); String physicalString = statement.columnString(3); try { queryStatus.physicalPlan = MyriaJsonMapperProvider.getMapper().readValue(physicalString, QueryEncoding.class); } catch (IOException e) { queryStatus.physicalPlan = physicalString; <START> System.out.println(e); <END> } queryStatus.submitTime = statement.columnString(4); queryStatus.startTime = statement.columnString(5); queryStatus.finishTime = statement.columnString(6); if (!statement.columnNull(7)) { queryStatus.elapsedNanos = statement.columnLong(7); } queryStatus.status = QueryStatusEncoding.Status.valueOf(statement.columnString(8)); return queryStatus; }</code><technical_language>Stray debugging code</technical_language>

Target:
private static QueryStatusEncoding queryStatusHelper(final SQLiteStatement statement) throws SQLiteException { final QueryStatusEncoding queryStatus = new QueryStatusEncoding(statement.columnLong(0)); queryStatus.rawQuery = statement.columnString(1); queryStatus.logicalRa = statement.columnString(2); String physicalString = statement.columnString(3); try { queryStatus.physicalPlan = MyriaJsonMapperProvider.getMapper().readValue(physicalString, QueryEncoding.class); } catch (IOException e) { queryStatus.physicalPlan = physicalString; } queryStatus.submitTime = statement.columnString(4); queryStatus.startTime = statement.columnString(5); queryStatus.finishTime = statement.columnString(6); if (!statement.columnNull(7)) { queryStatus.elapsedNanos = statement.columnLong(7); } queryStatus.status = QueryStatusEncoding.Status.valueOf(statement.columnString(8)); return queryStatus; }
Source:
<code>public static NovaTemplateOptions availabilityZone(String availabilityZone) { <START> return new NovaTemplateOptions().availabilityZone(availabilityZone); <END> }</code><technical_language>+1: I prefer this style over: NovaTemplateOptions options = new NovaTemplateOptions(); return options.availabilityZone(availabilityZone);</technical_language>

Target:
public static NovaTemplateOptions availabilityZone(String availabilityZone) { NovaTemplateOptions options = new NovaTemplateOptions(); return options.availabilityZone(availabilityZone); }
Source:
<code>public String[] optimize(String appModel, String suitableCloudOffer) { String[] outputPlans = new String[NUMBER_OF_PLANS_GENERATED]; outputPlans[0] = "Plan generation was not possible"; if (previousPlans == null) { OptimizerInitialDeployment initialOptimizer = new OptimizerInitialDeployment(searchName); try { outputPlans = initialOptimizer.optimize(appModel, suitableCloudOffer, NUMBER_OF_PLANS_GENERATED); previousPlans = outputPlans; } catch (Error E) { log.error("Error optimizing the initial deployment"); } } else { Reoptimizer optimizerReplanning = new Reoptimizer(searchName); try { log.error("Calling a Replanning. The previously generated Plan will be used as a base"); outputPlans = optimizerReplanning.optimize(appModel, suitableCloudOffer, NUMBER_OF_PLANS_GENERATED); previousPlans = outputPlans; } catch (Error E) { <START> log.error("Error optimizing the Replanning"); <END> } } return outputPlans; }</code><technical_language>If exception occurs corrective action, bubble exception. If not, error is masked. I enclose Error a OptimizerException, extends RuntimeException</technical_language>

Target:
public String[] optimize(String appModel, String suitableCloudOffer) { String[] outputPlans = new String[NUMBER_OF_PLANS_GENERATED]; outputPlans[0] = "Plan generation was not possible"; if (previousPlans == null) { OptimizerInitialDeployment initialOptimizer = new OptimizerInitialDeployment(searchName); try { outputPlans = initialOptimizer.optimize(appModel, suitableCloudOffer, NUMBER_OF_PLANS_GENERATED); previousPlans = outputPlans; } catch (Error E) { log.error("Error optimizing the initial deployment"); } } else { Reoptimizer optimizerReplanning = new Reoptimizer(searchName); try{ log.error("Calling a Replanning. The previously generated Plan will be used as a base"); outputPlans = optimizerReplanning.optimize(appModel, suitableCloudOffer, NUMBER_OF_PLANS_GENERATED); previousPlans = outputPlans; } catch (Error E) { log.error("Error optimizing the Replanning"); throw E; } } return outputPlans; }
Source:
<code>public void batchesConcurrentRequests() throws InterruptedException { freezableDelegate.freeze(); AsyncTasks tasks = getConcurrently(5); freezableDelegate.unfreeze(); tasks.await(); <START> verify(delegate, times(2)).get(); <END> }</code><technical_language>a bit of time figure out this is 2 (because a batch [1], [2345]). wondering if restructure test slightly this clearer? java @Test public void batchesConcurrentRequests() throws InterruptedException, ExecutionException { freezableDelegate.freeze(); AsyncTasks initialTask = getConcurrently(1); AsyncTasks batch = getConcurrently(5); freezableDelegate.unfreeze(); initialTask.await(); tasks.await(); verify(delegate, times(2)).get(); }</technical_language>

Target:
public void batchesConcurrentRequests() throws InterruptedException { freezableDelegate.freeze(); AsyncTasks initialTask = getConcurrently(1); AsyncTasks batch = getConcurrently(5); freezableDelegate.unfreeze(); batch.await(); verify(delegate, times(2)).get(); }
Source:
<code>public void lock() { try { this.mutex.acquire(); } catch (Exception e) { <START> throw new MessagingException("Failed to aquire mutex at " + this.path, e); <END> } }</code><technical_language>This a Messaging component other side this a Messaging component, raising a MessagingException here, prevent re-throwing a correct MessagingException failedMessage context. So, for simple RuntimeException is enough in this context. WDYT</technical_language>

Target:
public void lock() { try { this.mutex.acquire(); } catch (Exception e) { throw new RuntimeException("Failed to aquire mutex at " + this.path, e); } }
Source:
<code>private void pullModels() { <START> oldModel = vectorFactory.createDenseZeros(numFeatures); <END> for (int modelIndex = 0; modelIndex < numFeatures; modelIndex++) { oldModel.set(modelIndex, parameterWorker.pull(modelIndex)); } newModel = oldModel.copy(); }</code><technical_language>Do need this re-initialization? L164 sets fields of oldModel</technical_language>

Target:
private void pullModels() { for (int modelIndex = 0; modelIndex < numFeatures; modelIndex++) { oldModel.set(modelIndex, parameterWorker.pull(modelIndex)); } newModel = oldModel.copy(); }
Source:
<code>public OffheapIncrementalIndex( long minTimestamp, QueryGranularity gran, final AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, boolean sortFacts, int maxRowCount, StupidPool<ByteBuffer> bufferPool ) { this( new IncrementalIndexSchema.Builder().withMinTimestamp(minTimestamp) .withQueryGranularity(gran) .withMetrics(metrics) <START> .withRollup(true) <END> .build(), deserializeComplexMetrics, reportParseExceptions, sortFacts, maxRowCount, bufferPool ); }</code><technical_language>DEFAULT_ROLLUP constant instead</technical_language>

Target:
public OffheapIncrementalIndex( long minTimestamp, QueryGranularity gran, final AggregatorFactory[] metrics, boolean deserializeComplexMetrics, boolean reportParseExceptions, boolean sortFacts, int maxRowCount, StupidPool<ByteBuffer> bufferPool ) { this( new IncrementalIndexSchema.Builder().withMinTimestamp(minTimestamp) .withQueryGranularity(gran) .withMetrics(metrics) .withRollup(IncrementalIndexSchema.DEFAULT_ROLLUP) .build(), deserializeComplexMetrics, reportParseExceptions, sortFacts, maxRowCount, bufferPool ); }
Source:
<code><START> public void addComboActionButton(ActionButtonDefinition<T> buttonDef, List<ActionButtonDefinition<T>> subActions) { <END> ActionButton newButton = getView().addDropdownComboActionButton(buttonDef, subActions, this); actionButtonDefinitions.add(buttonDef); for (ActionButtonDefinition ab : subActions) { actionButtonDefinitions.add(ab); } initButton(buttonDef, newButton); }</code><technical_language>changing behavior of existing method? I feel missing</technical_language>

Target:
public void addComboActionButton(ActionButtonDefinition<T> buttonDef, List<ActionButtonDefinition<T>> subActions) { ActionButton newButton = getView().addDropdownComboActionButton(buttonDef, subActions, this); actionButtonDefinitions.add(buttonDef); initButton(buttonDef, newButton); }
Source:
<code>private void initializeRow() { LayoutParams params = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); params.leftMargin = params.topMargin = params.rightMargin = params.bottomMargin = getResources() .getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); int noteColor; if (isBlackRow) { noteColor = ContextCompat.getColor(getContext(), R.color.light_grey); } else { noteColor = ContextCompat.getColor(getContext(), R.color.white); } for (int i = 0; i < QUARTER_COUNT; i++) { List<GridRowPosition> gridRowPositions = new ArrayList<>(); if (gridRow != null) { <START> gridRowPositions = gridRow.getGridRowPositions().get(0); <END> } noteViews.add(new NoteView(getContext(), noteColor, gridRowPositions, i)); addView(noteViews.get(i), params); } }</code><technical_language>get(0) is intuitive</technical_language>

Target:
private void initializeRow() { LayoutParams params = new LayoutParams(0, LayoutParams.MATCH_PARENT, 1.0f); params.leftMargin = params.topMargin = params.rightMargin = params.bottomMargin = getResources() .getDimensionPixelSize(R.dimen.pocketmusic_trackrow_margin); int noteColor; if (isBlackRow) { noteColor = ContextCompat.getColor(getContext(), R.color.light_grey); } else { noteColor = ContextCompat.getColor(getContext(), R.color.white); } for (int i = 0; i < QUARTER_COUNT; i++) { List<GridRowPosition> gridRowPositions = new ArrayList<>(); if (gridRow != null) { gridRowPositions = getFirstGridRowPositionsList(); } noteViews.add(new NoteView(getContext(), noteColor, gridRowPositions, i)); addView(noteViews.get(i), params); } }
Source:
<code>public void MercuryCuratedNavigationTest_004_navigateThroughDifferentUrl() { <START> String testUrl; <END> String expectedUrl; CuratedContentPageObject section = new CuratedContentPageObject(driver); expectedUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_CATEGORY_TEMPLATES); testUrl = expectedUrl; section.openWikiPage(testUrl); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_SECTION_CATEGORIES); testUrl = expectedUrl; section.openWikiPage(testUrl); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPath(Configuration.getWikiName(), MercurySubpages.CC_MAIN_PAGE); testUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_EMPTY_CATEGORY); section.openWikiPage(testUrl); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPath(Configuration.getWikiName(), MercurySubpages.CC_MAIN_PAGE); testUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_NOT_EXISTING_SECTION); section.openWikiPage(testUrl); section.isAlertNotificationVisible(); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); }</code><technical_language>please declare variable in usage</technical_language>

Target:
public void MercuryCuratedNavigationTest_004_navigateThroughDifferentUrl() { CuratedContentPageObject section = new CuratedContentPageObject(driver); String expectedUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_CATEGORY_TEMPLATES); String testUrl = expectedUrl; section.openWikiPage(testUrl); section.waitForLoadingSpinnerToFinish(); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_SECTION_CATEGORIES); testUrl = expectedUrl; section.openWikiPage(testUrl); section.waitForLoadingSpinnerToFinish(); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPath(Configuration.getWikiName(), MercurySubpages.CC_MAIN_PAGE); testUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_EMPTY_CATEGORY); section.openWikiPage(testUrl); section.waitForLoadingSpinnerToFinish(); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); expectedUrl = urlBuilder.getUrlForPath(Configuration.getWikiName(), MercurySubpages.CC_MAIN_PAGE); testUrl = urlBuilder.getUrlForPathWithoutWiki(Configuration.getWikiName(), MercurySubpages.CC_NOT_EXISTING_SECTION); section.openWikiPage(testUrl); section.waitForLoadingSpinnerToFinish(); section.isAlertNotificationVisible(); Assertion.assertUrlEqualToCurrentUrl(driver, expectedUrl); }
Source:
<code>private void checkAttributesDependencies(PerunSession sess, Member member, Group group, List<Attribute> attributes, boolean workWithUserAttributes) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { if(workWithUserAttributes) { User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); List<Attribute> userAttributes = new ArrayList<Attribute>(); List<Attribute> memberAttributes = new ArrayList<Attribute>(); List<Attribute> memberGroupAttributes = new ArrayList<Attribute>(); for(Attribute attr: attributes) { if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_USER_ATTR)) { userAttributes.add(attr); } else if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_MEMBER_ATTR)) { memberAttributes.add(attr); } else if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_MEMBER_GROUP_ATTR)) { memberGroupAttributes.add(attr); } else { throw new WrongAttributeAssignmentException(attr); } } checkAttributesDependencies(sess, member, null, memberAttributes); checkAttributesDependencies(sess, user, null, userAttributes); <START> checkAttributesDependencies(sess, group, member, memberGroupAttributes); <END> } else { checkAttributesDependencies(sess, member, group, attributes); } }</code><technical_language>This is minority problem change in behavior, please, order of holders for calling. (there row below) thanks</technical_language>

Target:
private void checkAttributesDependencies(PerunSession sess, Member member, Group group, List<Attribute> attributes, boolean workWithUserAttributes) throws InternalErrorException, WrongAttributeValueException, WrongAttributeAssignmentException, WrongReferenceAttributeValueException { if(workWithUserAttributes) { User user = getPerunBl().getUsersManagerBl().getUserByMember(sess, member); List<Attribute> userAttributes = new ArrayList<Attribute>(); List<Attribute> memberAttributes = new ArrayList<Attribute>(); List<Attribute> memberGroupAttributes = new ArrayList<Attribute>(); for(Attribute attr: attributes) { if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_USER_ATTR)) { userAttributes.add(attr); } else if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_MEMBER_ATTR)) { memberAttributes.add(attr); } else if(getAttributesManagerImpl().isFromNamespace(sess, attr, NS_MEMBER_GROUP_ATTR)) { memberGroupAttributes.add(attr); } else { throw new WrongAttributeAssignmentException(attr); } } checkAttributesDependencies(sess, member, null, memberAttributes); checkAttributesDependencies(sess, user, null, userAttributes); checkAttributesDependencies(sess, member, group, memberGroupAttributes); } else { checkAttributesDependencies(sess, member, group, attributes); } }
Source:
<code>protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); DynamicNode stageNode = (DynamicNode) node; stageNode.setAutoComplete(false); stageNode.setLanguage("rule"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem stagePlanItem = planItems.get(stageNode.getMetaData("UniqueId")); if (stagePlanItem != null && stagePlanItem.getEntryCriterion() != null) { if(AUTOCOMPLETE_EXPRESSIONS.contains(stagePlanItem.getEntryCriterion().getExpression())) { <START> stageNode.setAutoComplete(true); <END> } else { stageNode.setActivationExpression(stagePlanItem.getEntryCriterion().getExpression()); } } if (stagePlanItem != null && stagePlanItem.getExitCriterion() != null) { stageNode.setCompletionExpression(stagePlanItem.getExitCriterion().getExpression()); } }</code><technical_language>this check ExitCriterion do other way? I Entry criterion is a criterion based execution activate stage - enter stage. IIRC CMMN states autoComplete is a separate attribute of a stage. is confusing EntryCriterion controls stage completed</technical_language>

Target:
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { super.handleNode(node, element, uri, localName, parser); DynamicNode stageNode = (DynamicNode) node; stageNode.setAutoComplete(false); stageNode.setLanguage("rule"); ProcessBuildData buildData = (ProcessBuildData) parser.getData(); Map<String, PlanItem> planItems = (Map<String, PlanItem>) buildData.getMetaData("PlanItems"); PlanItem stagePlanItem = planItems.get(stageNode.getMetaData("UniqueId")); if (stagePlanItem != null && stagePlanItem.getEntryCriterion() != null) { if ("autostart".equalsIgnoreCase(stagePlanItem.getEntryCriterion().getExpression())) { stageNode.setMetaData("customAutoStart", "true"); } else { stageNode.setActivationExpression(stagePlanItem.getEntryCriterion().getExpression()); } } if (stagePlanItem != null && stagePlanItem.getExitCriterion() != null) { if (AUTOCOMPLETE_EXPRESSIONS.contains(stagePlanItem.getExitCriterion().getExpression())) { stageNode.setAutoComplete(true); } else { stageNode.setCompletionExpression(stagePlanItem.getExitCriterion().getExpression()); } } }
Source:
<code>private boolean isInTimeRange(ITmfTimestamp traceStartTime, ITmfTimestamp traceEndTime) { <START> if <END> (traceStartTime.compareTo(fEndTimeRange) <= 0 && traceEndTime.compareTo(fStartTimeRange) >= 0) { return true; } return false; }</code><technical_language>return condition 's directly</technical_language>

Target:
private boolean isInTimeRange(ITmfTimestamp traceStartTime, ITmfTimestamp traceEndTime) { return traceStartTime.compareTo(fEndTimeRange) <= 0 && traceEndTime.compareTo(fStartTimeRange) >= 0; }
Source:
<code>public IgniteZeroMqStreamer(int ioThreads, ZeroMqTypeSocket socketType, @NotNull String addr, byte[] topic) { A.ensure(ioThreads > 0, "Param ioThreads has been more than 0."); A.ensure(!"".equals(addr), "Param addr has been not empty."); this.ioThreads = ioThreads; this.addr = addr; this.topic = topic; if (ZeroMqTypeSocket.check(socketType)) this.socketType = socketType.getType(); else <START> throw new IgniteException("This socket type not implementation this version ZeroMQ streamer."); <END> }</code><technical_language>"This socket type is implemented in this version of ZeroMQ streamer</technical_language>

Target:
public IgniteZeroMqStreamer(int ioThreads, ZeroMqTypeSocket socketType, @NotNull String addr, byte[] topic) { A.ensure(ioThreads > 0, "ioThreads has to larger than 0."); A.ensure(!"".equals(addr), "addr cannot be empty."); A.ensure(socketType != null, "socketType is not null."); this.ioThreads = ioThreads; this.addr = addr; this.topic = topic; this.socketType = socketType.getType(); }
Source:
<code>public String[] getValueNames() { Collection<String> result = getAttributeNames0(); return <START> getAttributeNames0().toArray(new <END> String[result.size()]); }</code><technical_language>is this supposed result.toArray(...)</technical_language>

Target:
public String[] getValueNames() { Collection<String> result = getAttributeNames0(); return result.toArray(new String[result.size()]); }
Source:
<code>public int getWeight(EStructuralFeature feature) { if (irrelevant(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if (feature == EcorePackage.Literals.ENAMED_ELEMENT__NAME) { found = Integer.valueOf(SIGNIFICANT); } <START> if (feature instanceof EReference && ((EReference)feature).isContainment()) { <END> found = Integer.valueOf(NORMAL); } if (feature instanceof EReference) { found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } weights.put(feature, found); } return found.intValue(); }</code><technical_language>this happen a containment reference is stated irrelevant that</technical_language>

Target:
public int getWeight(EStructuralFeature feature) { if (irrelevant(feature)) { return 0; } Integer found = weights.get(feature); if (found == null) { found = Integer.valueOf(SMALL); if (feature == EcorePackage.Literals.ENAMED_ELEMENT__NAME) { found = Integer.valueOf(SIGNIFICANT); } if (feature instanceof EReference) { found = Integer.valueOf(referenceChangeCoef * found.intValue()); } else { found = Integer.valueOf(attributeChangeCoef * found.intValue()); } weights.put(feature, found); } return found.intValue(); }
Source:
<code><START> public static void automaticIP() throws ClassNotFoundException, SQLException, UnknownHostException{ <END> Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://mysql.cs.iastate.edu/db30901", "adm309", "EXbDqudt4"); Statement stmt = con.createStatement(); String iP =InetAddress.getLocalHost().getHostAddress(); stmt.executeUpdate("UPDATE testTable SET IP_Computer='" + iP + "' WHERE phoneNumber='" + lastLoggedIn() + "';"); }</code><technical_language>here, if handle exceptions call handle of method</technical_language>

Target:
public static void automaticIP(){ try { Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://mysql.cs.iastate.edu/db30901", "adm309", "EXbDqudt4"); Statement stmt = con.createStatement(); String iP =InetAddress.getLocalHost().getHostAddress(); stmt.executeUpdate("UPDATE testTable SET IP_Computer='" + iP + "' WHERE phoneNumber='" + lastLoggedIn() + "';"); } catch (Exception e) { System.out.println("Automatic login fail\n" + e.getMessage()); } }
Source:
<code>public String getNodesInfo() { try { <START> Response response = lowLevelClient.performRequest("GET", "/" + "_nodes/_all"); <END> return EntityUtils.toString(response.getEntity()); } catch (IOException e) { throw new NuxeoException(e); } }</code><technical_language>Put / in "_nodes/_all" string</technical_language>

Target:
public String getNodesInfo() { try { Response response = lowLevelClient.performRequest("GET", "/_nodes/_all"); return EntityUtils.toString(response.getEntity()); } catch (IOException e) { throw new NuxeoException(e); } }
Source:
<code>public void testRowTimestampDefault() throws Exception { String tableName = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (PK INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR, KV2 VARCHAR)" + this.tableDDLOptions; conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + tableName + " (PK, KV1, KV2) VALUES (?, ?, ?)"; <START> PreparedStatement stmt = conn.prepareStatement(dml); <END> int count = 5; for (int id = 0; id < count; ++id) { stmt.setInt(1, id); stmt.setString(2, "KV1_" + id); stmt.setString(3, "KV2_" + id); stmt.executeUpdate(); } conn.commit(); String dql = "SELECT PHOENIX_ROW_TIMESTAMP() FROM " + tableName; ResultSet rs = conn.createStatement().executeQuery(dql); verifyHbaseAllRowsTimestamp(tableName, rs, count); conn.createStatement().execute("UPSERT INTO " + tableName + " (PK, KV1) VALUES (2, 'KV1_foo')"); conn.commit(); rs = conn.createStatement().executeQuery(dql); verifyHbaseAllRowsTimestamp(tableName, rs, count); dql = "SELECT ROWKEY_BYTES_STRING(), PHOENIX_ROW_TIMESTAMP() FROM " + tableName + " WHERE PK >= 1 AND PK <=3 "; rs = conn.createStatement().executeQuery(dql); while (rs.next()) { verifyHbaseRowTimestamp(tableName, rs.getString(1), rs.getDate(2)); } } }</code><technical_language>nit: try-with-resources close this statement</technical_language>

Target:
public void testRowTimestampDefault() throws Exception { String tableName = generateUniqueName(); try (Connection conn = DriverManager.getConnection(getUrl())) { String ddl = "CREATE TABLE IF NOT EXISTS " + tableName + " (PK INTEGER NOT NULL PRIMARY KEY, KV1 VARCHAR, KV2 VARCHAR)" + this.tableDDLOptions; conn.createStatement().execute(ddl); String dml = "UPSERT INTO " + tableName + " (PK, KV1, KV2) VALUES (?, ?, ?)"; try (PreparedStatement stmt = conn.prepareStatement(dml)) { int count = NUM_ROWS; for (int id = 0; id < count; ++id) { stmt.setInt(1, id); stmt.setString(2, "KV1_" + id); stmt.setString(3, "KV2_" + id); stmt.executeUpdate(); } } finally { conn.commit(); } String dql = "SELECT PHOENIX_ROW_TIMESTAMP() FROM " + tableName; try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery(dql); verifyHbaseAllRowsTimestamp(tableName, rs, NUM_ROWS); } try (Statement stmt = conn.createStatement()) { stmt.execute("UPSERT INTO " + tableName + " (PK, KV1) VALUES (2, 'KV1_foo')"); } finally { conn.commit(); } try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery(dql); verifyHbaseAllRowsTimestamp(tableName, rs, NUM_ROWS); } dql = "SELECT ROWKEY_BYTES_STRING(), PHOENIX_ROW_TIMESTAMP() FROM " + tableName + " WHERE PK >= 1 AND PK <=3 "; try (Statement stmt = conn.createStatement()) { ResultSet rs = stmt.executeQuery(dql); while (rs.next()) { verifyHbaseRowTimestamp(tableName, rs.getString(1), rs.getDate(2)); } } } }
Source:
<code>public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { String selector[] = StringUtils.split(StringUtils.trim(bindingConfig), ':'); try { PowerMaxSelectorType.fromString(selector[0]); } catch (IllegalArgumentException e) { <START> throw new BindingConfigParseException("item '" + item.getName() + "': invalid selector " + bindingConfig); <END> } }</code><technical_language>If do in a validateItemType override is validate item type, this check instead happen in processBindingConfiguration</technical_language>

Target:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { }
Source:
<code>public void startService() { super.startService(); arduino = (Arduino) Runtime.start("arduino", "Arduino"); adaFruit16cLeft = (Adafruit16CServoDriver) Runtime.start("I2cServoControlLeft", "Adafruit16CServoDriver"); adaFruit16cRight = (Adafruit16CServoDriver) Runtime.start("I2cServoControlRight", "Adafruit16CServoDriver"); chatBot = (ProgramAB) Runtime.start("chatBot", "ProgramAB"); htmlFilter = (HtmlFilter) Runtime.start("htmlFilter", "HtmlFilter"); <START> mouth = (AbstractSpeechSynthesis) Runtime.start("mouth", "MarySpeech"); <END> ear = (WebkitSpeechRecognition) Runtime.start("ear", "WebkitSpeechRecognition"); webgui = (WebGui) Runtime.start("webgui", "WebGui"); pir = (Pir) Runtime.start("pir", "Pir"); pir.attach(arduino, pirSensorPin); subscribe(mouth.getName(), "publishStartSpeaking"); subscribe(mouth.getName(), "publishEndSpeaking"); }</code><technical_language>this interface, abstract class..</technical_language>

Target:
public void startService() { super.startService(); arduino = (Arduino) Runtime.start("arduino", "Arduino"); adaFruit16cLeft = (Adafruit16CServoDriver) Runtime.start("I2cServoControlLeft", "Adafruit16CServoDriver"); adaFruit16cRight = (Adafruit16CServoDriver) Runtime.start("I2cServoControlRight", "Adafruit16CServoDriver"); chatBot = (ProgramAB) Runtime.start("chatBot", "ProgramAB"); htmlFilter = (HtmlFilter) Runtime.start("htmlFilter", "HtmlFilter"); mouth = (SpeechSynthesis) Runtime.start("mouth", "MarySpeech"); ear = (WebkitSpeechRecognition) Runtime.start("ear", "WebkitSpeechRecognition"); webgui = (WebGui) Runtime.start("webgui", "WebGui"); pir = (Pir) Runtime.start("pir", "Pir"); pir.attach(arduino, pirSensorPin); subscribe(mouth.getName(), "publishStartSpeaking"); subscribe(mouth.getName(), "publishEndSpeaking"); }
Source:
<code>public void updateSendTime(long value) { requestOrResponseSendTime.update(value); if (requestOrResponseSendTimeBySize != null) { <START> requestOrResponseSendTimeBySize.update(value); <END> } timeSpentTillNow += value; requestOrResponseTotalTime.update(timeSpentTillNow); if (requestOrResponseTotalTimeBySize != null) { requestOrResponseTotalTimeBySize.update(timeSpentTillNow); } }</code><technical_language>I difference requestOrResponseSendTime requestOrResponseSendTimeBySize. for requestOrResponseTotalTime requestOrResponseTotalTimeBySize. updated way. Do know</technical_language>

Target:
public void updateSendTime(long value) { sendTime.update(value); }
Source:
<code>@Override public void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException { ByteBuffer input = checkMessage(ses, msg); GridNioSslHandler hnd = sslHandler(ses); GridSslMeta meta = ses.meta(SSL_META.ordinal()); <START> if (meta.sslEngine() == null) <END> meta.sslEngine(hnd.sslEngine()); hnd.lock(); try { hnd.messageReceived(input); if (hnd.isHandshakeFinished()) hnd.flushDeferredWrites(); ByteBuffer appBuf = hnd.getApplicationBuffer(); appBuf.flip(); if (appBuf.hasRemaining()) proceedMessageReceived(ses, appBuf); appBuf.compact(); if (hnd.isInboundDone() && !hnd.isOutboundDone()) { if (log.isDebugEnabled()) log.debug("Remote peer closed secure session (will close connection): " + ses); shutdownSession(ses, hnd); } } catch (SSLException e) { throw new GridNioException("Failed to decode SSL data: " + ses, e); } finally { hnd.unlock(); } }</code><technical_language>meta is nullable contract. NPE is here</technical_language>

Target:
@Override public void onMessageReceived(GridNioSession ses, Object msg) throws IgniteCheckedException { ByteBuffer input = checkMessage(ses, msg); GridNioSslHandler hnd = sslHandler(ses); hnd.lock(); try { hnd.messageReceived(input); if (hnd.isHandshakeFinished()) hnd.flushDeferredWrites(); ByteBuffer appBuf = hnd.getApplicationBuffer(); appBuf.flip(); if (appBuf.hasRemaining()) proceedMessageReceived(ses, appBuf); appBuf.compact(); if (hnd.isInboundDone() && !hnd.isOutboundDone()) { if (log.isDebugEnabled()) log.debug("Remote peer closed secure session (will close connection): " + ses); shutdownSession(ses, hnd); } } catch (SSLException e) { throw new GridNioException("Failed to decode SSL data: " + ses, e); } finally { hnd.unlock(); } }
Source:
<code>AmbryPartitionStateModel(String resourceName, String partitionName, PartitionStateChangeListener partitionStateChangeListener) { this.resourceName = resourceName; this.partitionName = partitionName; <START> this.partitionStateChangeListener = partitionStateChangeListener; <END> StateModelParser parser = new StateModelParser(); _currentState = parser.getInitialState(DefaultLeaderStandbyStateModel.class); }</code><technical_language>Good add a null check required</technical_language>

Target:
AmbryPartitionStateModel(String resourceName, String partitionName, PartitionStateChangeListener partitionStateChangeListener) { this.resourceName = resourceName; this.partitionName = partitionName; this.partitionStateChangeListener = Objects.requireNonNull(partitionStateChangeListener); StateModelParser parser = new StateModelParser(); _currentState = parser.getInitialState(DefaultLeaderStandbyStateModel.class); }
Source:
<code>private void logRequest(final HttpServletRequest req, final Session session) { final StringBuilder buf = new StringBuilder(); buf.append(getRealClientIpAddr(req)).append(" "); if (session != null && session.getUser() != null) { buf.append(session.getUser().getUserId()).append(" "); } else { buf.append(" - ").append(" "); } buf.append("\""); buf.append(req.getMethod()).append(" "); buf.append(req.getRequestURI()).append(" "); <START> if (req.getQueryString() != null && allowedPostRequest(req)) { <END> buf.append(req.getQueryString()).append(" "); } else { buf.append("-").append(" "); } buf.append(req.getProtocol()).append("\" "); final String userAgent = req.getHeader("User-Agent"); if (this.shouldLogRawUserAgent) { buf.append(userAgent); } else { if (StringUtils.isFromBrowser(userAgent)) { buf.append("browser"); } else { buf.append("not-browser"); } } logger.info(buf.toString()); }</code><technical_language>req.getQueryString() != null is necessary check is done in allowedPostRequest</technical_language>

Target:
private void logRequest(final HttpServletRequest req, final Session session) { final StringBuilder buf = new StringBuilder(); buf.append(getRealClientIpAddr(req)).append(" "); if (session != null && session.getUser() != null) { buf.append(session.getUser().getUserId()).append(" "); } else { buf.append(" - ").append(" "); } buf.append("\""); buf.append(req.getMethod()).append(" "); buf.append(req.getRequestURI()).append(" "); if (req.getQueryString() != null && !isIllegalPostRequest(req)) { buf.append(req.getQueryString()).append(" "); } else { buf.append("-").append(" "); } buf.append(req.getProtocol()).append("\" "); final String userAgent = req.getHeader("User-Agent"); if (this.shouldLogRawUserAgent) { buf.append(userAgent); } else { if (StringUtils.isFromBrowser(userAgent)) { buf.append("browser"); } else { buf.append("not-browser"); } } logger.info(buf.toString()); }
Source:
<code>public InterpreterResult execute(String[] tokens) { Jedis client = borrowClient(); try { return new InterpreterResult(SUCCESS, execute(client, tokens)); } catch (JedisException exception) { <START> return new InterpreterResult(ERROR, exception.getMessage()); <END> } finally { releaseClient(client); } }</code><technical_language>do adding a LOG.error here? LOG.error("Couldn't execute redis command {}", token[0], e);</technical_language>

Target:
public InterpreterResult execute(String[] tokens) { try (Jedis client = clientPool.getResource()) { try { return new InterpreterResult(SUCCESS, execute(client, tokens)); } catch (JedisException exception) { LOG.error("Couldn't execute redis command {}", tokens[0], exception); return new InterpreterResult(ERROR, exception.getMessage()); } } }