auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void updateRegionCache(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { if (bucketName != null && this.accessKey != null && this.secretKey != null && !BucketRegionCache.INSTANCE.exists(bucketName)) { String region; if (!this.region.equals("")) { region = this.region; } else { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("location", null); HttpResponse response = execute(Method.GET, US_EAST_1, bucketName, null, null, queryParamMap, null, 0); XmlPullParser xpp = xmlPullParserFactory.newPullParser(); String location = null; xpp.setInput(response.body().charStream()); while (xpp.getEventType() != xpp.END_DOCUMENT) { if (xpp.getEventType() == xpp.START_TAG && xpp.getName() == "LocationConstraint") { xpp.next(); location = getText(xpp, location); break; } xpp.next(); } response.body().close(); if (location == null) { region = US_EAST_1; } else { if ("EU".equals(location)) { region = "eu-west-1"; } else { region = location; } } } <START> BucketRegionCache.INSTANCE.set(bucketName, region); <END> } }</code><technical_language>I thought of BucketRegionCache.region() return passed region for non-empty bucket name. I OK this approach too</technical_language>

Target:
private void updateRegionCache(String bucketName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { if (bucketName != null && this.accessKey != null && this.secretKey != null && !BucketRegionCache.INSTANCE.exists(bucketName)) { Map<String,String> queryParamMap = new HashMap<>(); queryParamMap.put("location", null); HttpResponse response = execute(Method.GET, US_EAST_1, bucketName, null, null, queryParamMap, null, 0); XmlPullParser xpp = xmlPullParserFactory.newPullParser(); String location = null; xpp.setInput(response.body().charStream()); while (xpp.getEventType() != xpp.END_DOCUMENT) { if (xpp.getEventType() == xpp.START_TAG && xpp.getName() == "LocationConstraint") { xpp.next(); location = getText(xpp, location); break; } xpp.next(); } response.body().close(); String region; if (location == null) { region = US_EAST_1; } else { if ("EU".equals(location)) { region = "eu-west-1"; } else { region = location; } } BucketRegionCache.INSTANCE.set(bucketName, region); } }
Source:
<code>public void recover(Message message, Throwable cause) { Map<String, Object> headers = message.getMessageProperties().getHeaders(); headers.put("x-exception-stacktrace", getStackTraceAsString(cause)); headers.put("x-exception-message", cause.getCause() != null ? cause.getCause().getMessage() : cause.getMessage()); headers.put("x-original-exchange", message.getMessageProperties().getReceivedExchange()); headers.put("x-original-routingKey", message.getMessageProperties().getReceivedRoutingKey()); if (null != errorExchangeName) { String routingKey = errorRoutingKey != null ? errorRoutingKey : message.getMessageProperties().getReceivedRoutingKey(); this.errorTemplate.send(errorExchangeName, routingKey, message); if (logger.isWarnEnabled()) { logger.warn("Republishing failed message to exchange " + errorExchangeName); } } else { <START> final String routingKey = "error." + message.getMessageProperties().getReceivedRoutingKey(); <END> this.errorTemplate.send(routingKey, message); if (logger.isWarnEnabled()) { logger.warn("Republishing failed message to the template's default exchange with routing key " + routingKey); } } }</code><technical_language>is previouse case for getReceivedRoutingKey() error. prefix</technical_language>

Target:
public void recover(Message message, Throwable cause) { Map<String, Object> headers = message.getMessageProperties().getHeaders(); headers.put("x-exception-stacktrace", getStackTraceAsString(cause)); headers.put("x-exception-message", cause.getCause() != null ? cause.getCause().getMessage() : cause.getMessage()); headers.put("x-original-exchange", message.getMessageProperties().getReceivedExchange()); headers.put("x-original-routingKey", message.getMessageProperties().getReceivedRoutingKey()); if (null != errorExchangeName) { String routingKey = errorRoutingKey != null ? errorRoutingKey : this.prefixedOriginalRoutingKey(message); this.errorTemplate.send(errorExchangeName, routingKey, message); if (logger.isWarnEnabled()) { logger.warn("Republishing failed message to exchange " + errorExchangeName); } } else { final String routingKey = this.prefixedOriginalRoutingKey(message); this.errorTemplate.send(routingKey, message); if (logger.isWarnEnabled()) { logger.warn("Republishing failed message to the template's default exchange with routing key " + routingKey); } } }
Source:
<code>public void testPutSynonymCatalogFile() throws Exception { final File file = new File("src/test/resources/testsynonymcatalog"); final MockMultipartFile multipartFile = new MockMultipartFile("file", "testsynonymcatalog", "text/plain", new FileInputStream(file)); final MvcResult mvcResult = _mockMvc.perform( fileUpload("/test/referencedata/synonymCatalog/testCatalog").file(multipartFile).with(withPut()) <START> .contentType(MediaType.MULTIPART_FORM_DATA).param("casesensitive", "false")).andExpect(status().isCreated()).andExpect( <END> header().string("Location", is("http://localhost/test/referencedata/synonymCatalog/testCatalog"))) .andReturn(); final String location = mvcResult.getResponse().getHeader("Location"); _mockMvc.perform(get(location)).andExpect(status().isOk()).andExpect(jsonPath("$.name", is("testCatalog"))) .andExpect(jsonPath("$.entries", hasSize(1))).andExpect(jsonPath("$.entries[0].masterTerm", is("foo"))) .andExpect(jsonPath("$.entries[0].synonyms", hasSize(2))) .andExpect(jsonPath("$.entries[0].synonyms[1]", is("baz"))) .andExpect(jsonPath("$.caseSensitive", is(false))); }</code><technical_language>Line is longer 130 characters (found 143)</technical_language>

Target:
public void testPutSynonymCatalogFile() throws Exception { final byte[] bytes = Files.readAllBytes(Paths.get("src/test/resources/testsynonymcatalog")); final MvcResult mvcResult = _mockMvc.perform( put("/test/referencedata/synonymCatalog/testCatalog").content(bytes).param("casesensitive", "false")) .andExpect(status().isCreated()).andExpect(header().string("Location", is("http://localhost/test/referencedata/synonymCatalog/testCatalog"))).andReturn(); final String location = mvcResult.getResponse().getHeader("Location"); _mockMvc.perform(get(location)).andExpect(status().isOk()).andExpect(jsonPath("$.name", is("testCatalog"))) .andExpect(jsonPath("$.entries", hasSize(1))).andExpect(jsonPath("$.entries[0].masterTerm", is("foo"))) .andExpect(jsonPath("$.entries[0].synonyms", hasSize(2))) .andExpect(jsonPath("$.entries[0].synonyms[1]", is("baz"))) .andExpect(jsonPath("$.caseSensitive", is(false))); }
Source:
<code>public static String[] getIndices(final String table, final ActionRequest request) throws Exception { final Interval interval = new PeriodSelector(request.getFilters()).analyze(); DateTime start = interval.getStart().toLocalDate().toDateTimeAtStartOfDay(); if(start.getYear() == 1970) { logger.warn("Request of type running on all indices", request.getClass().getSimpleName()); return getIndices(table); } DateTime end = interval.getEnd().plusDays(1).toLocalDate().toDateTimeAtStartOfDay(); List<String> indices = Lists.newArrayList(); String lastIndex = ""; String index = ""; while (true) { index = String.format("%s-%s-%s-%s", <START> ElasticsearchUtils.TABLENAME_PREFIX, table, ElasticsearchUtils.TABLENAME_POSTFIX, <END> String.format("%02d-%d-%4d", start.dayOfMonth().get(), start.monthOfYear().get(), start.year().get())); if(index.equals(lastIndex)) { break; } if(new Duration(start, end).getStandardSeconds() < 86400) { break; } indices.add(index); lastIndex = index; start = start.plusDays(1); } logger.info("Request of type on indices: {}", request.getClass().getSimpleName(), indices); return indices.toArray(new String[indices.size()]); }</code><technical_language>getCurrentIndex() method create index</technical_language>

Target:
public static String[] getIndices(final String table, final ActionRequest request) throws Exception { return getIndices(table, request, new PeriodSelector(request.getFilters()).analyze()); }
Source:
<code>public void deployService() throws Exception { super.init(); loadESBConfigurationFromClasspath("/artifacts/ESB/mediatorconfig/clone/cloneMediatorHandleException.xml"); <START> logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie()); <END> }</code><technical_language>call logViewerClient.clearLogs(). clear logs retrieve logs calling logViewerClient.getAllSystemLogs()</technical_language>

Target:
public void deployService() throws Exception { super.init(); loadESBConfigurationFromClasspath("/artifacts/ESB/mediatorconfig/clone/cloneMediatorHandleException.xml"); logViewerClient = new LogViewerClient(contextUrls.getBackEndUrl(), getSessionCookie()); logViewerClient.clearLogs(); }
Source:
<code>private void setFinalResult( Result resultMessage, Frame responseFrame, boolean schemaInAgreement, NodeResponseCallback callback) { try { ExecutionInfo executionInfo = buildExecutionInfo(callback, resultMessage, responseFrame, schemaInAgreement); AsyncResultSet resultSet = Conversions.toResultSet(resultMessage, executionInfo, session, context); if (result.complete(resultSet)) { cancelScheduledTasks(); throttler.signalSuccess(this); long completionTimeNanos = -1, totalLatencyNanos = -1; if (!(requestTracker instanceof NoopRequestTracker)) { completionTimeNanos = System.nanoTime(); <START> totalLatencyNanos = completionTimeNanos - startTimeNanos; <END> long nodeLatencyNanos = completionTimeNanos - callback.nodeStartTimeNanos; requestTracker.onNodeSuccess( statement, nodeLatencyNanos, executionProfile, callback.node); requestTracker.onSuccess(statement, totalLatencyNanos, executionProfile, callback.node); } if (sessionMetricUpdater.isEnabled( DefaultSessionMetric.CQL_REQUESTS, executionProfile.getName())) { if (completionTimeNanos < 0) { completionTimeNanos = System.nanoTime(); totalLatencyNanos = completionTimeNanos - startTimeNanos; } sessionMetricUpdater.updateTimer( DefaultSessionMetric.CQL_REQUESTS, executionProfile.getName(), totalLatencyNanos, TimeUnit.NANOSECONDS); } } } catch (Throwable error) { setFinalError(error, callback.node, -1); } }</code><technical_language>In case NoopRequestTracker requestTracker? Is this case</technical_language>

Target:
private void setFinalResult( Result resultMessage, Frame responseFrame, boolean schemaInAgreement, NodeResponseCallback callback) { try { ExecutionInfo executionInfo = buildExecutionInfo(callback, resultMessage, responseFrame, schemaInAgreement); AsyncResultSet resultSet = Conversions.toResultSet(resultMessage, executionInfo, session, context); if (result.complete(resultSet)) { cancelScheduledTasks(); throttler.signalSuccess(this); long completionTimeNanos = NANOTIME_NOT_MEASURED_YET, totalLatencyNanos = NANOTIME_NOT_MEASURED_YET; if (!(requestTracker instanceof NoopRequestTracker)) { completionTimeNanos = System.nanoTime(); totalLatencyNanos = completionTimeNanos - startTimeNanos; long nodeLatencyNanos = completionTimeNanos - callback.nodeStartTimeNanos; requestTracker.onNodeSuccess( statement, nodeLatencyNanos, executionProfile, callback.node); requestTracker.onSuccess(statement, totalLatencyNanos, executionProfile, callback.node); } if (sessionMetricUpdater.isEnabled( DefaultSessionMetric.CQL_REQUESTS, executionProfile.getName())) { if (completionTimeNanos == NANOTIME_NOT_MEASURED_YET) { completionTimeNanos = System.nanoTime(); totalLatencyNanos = completionTimeNanos - startTimeNanos; } sessionMetricUpdater.updateTimer( DefaultSessionMetric.CQL_REQUESTS, executionProfile.getName(), totalLatencyNanos, TimeUnit.NANOSECONDS); } } } catch (Throwable error) { setFinalError(error, callback.node, -1); } }
Source:
<code>public EnumTypeAdapter(Class<T> classOfT) { try { for (Field field : classOfT.getDeclaredFields()) { if (!field.isEnumConstant()) { continue; } field.setAccessible(true); T constant = (T)(field.get(null)); String name = constant.name(); SerializedName annotation = field.getAnnotation(SerializedName.class); if (annotation != null) { name = annotation.value(); for (String alternate : annotation.alternate()) { nameToConstant.put(alternate, constant); } } nameToConstant.put(name, constant); constantToName.put(constant, name); } } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (NullPointerException e) { throw new AssertionError(e); <START> } catch (ExceptionInInitializerError e) { <END> throw new AssertionError(e); } }</code><technical_language>catch this</technical_language>

Target:
public EnumTypeAdapter(Class<T> classOfT) { try { for (Field field : classOfT.getDeclaredFields()) { if (!field.isEnumConstant()) { continue; } field.setAccessible(true); @SuppressWarnings("unchecked") T constant = (T)(field.get(null)); String name = constant.name(); SerializedName annotation = field.getAnnotation(SerializedName.class); if (annotation != null) { name = annotation.value(); for (String alternate : annotation.alternate()) { nameToConstant.put(alternate, constant); } } nameToConstant.put(name, constant); constantToName.put(constant, name); } } catch (IllegalAccessException e) { throw new AssertionError(e); } }
Source:
<code>public boolean isEmergencyOnly() { return (mServiceState != null && mServiceState.getNetworkRegistrationInfoList().stream() <START> .filter(NetworkRegistrationInfo::isInService) <END> .allMatch(NetworkRegistrationInfo::isEmergencyEnabled)); }</code><technical_language>isRegistered() instead? below</technical_language>

Target:
public boolean isEmergencyOnly() { return (mServiceState != null && mServiceState.getNetworkRegistrationInfoList().stream() .filter(NetworkRegistrationInfo::isRegistered) .allMatch(NetworkRegistrationInfo::isEmergencyEnabled)); }
Source:
<code>public static void main(String[] args) { Options options = getRequiredOptions(); CommandLineParser parser = new DefaultParser(); try { CommandLine cmd = parser.parse(options, args); String folderPath = executeDownloader(cmd); <START> System.out.println("The download completed successfully and the zip folder is located : " + FolderCompressor.compress(folderPath)); <END> } catch (ParseException exp) { System.out.println(exp.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Migrator", options); } catch (RepresentationNotExistsException ex) { System.out.println(ex.getMessage()); } catch (MimeTypeException e) { System.out.println("The downloaded records have unrecognised mimeType"); } catch (ZipException e) { System.out.println("Exception happened during zipping the folder" + e.getMessage()); } catch (MCSException | DriverException e) { System.out.println("An exception happened while communicating with mcs" + e.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); } }</code><technical_language>Compressed file is put temp random name. download completed successfully zip folder is located : /tmp/10d3a94a-34d7-4e8d-aafb-b6df7e601eca5107900615026729283.zip</technical_language>

Target:
public static void main(String[] args) { Options options = getOptions(); CommandLineParser parser = new DefaultParser(); String zipFolderPath = FileUtil.createZipFolderPath(new Date()); CommandLine cmd = null; try { cmd = parser.parse(options, args); String folderPath = executeDownloader(cmd); FolderCompressor.compress(folderPath, zipFolderPath); System.out.println("The download completed successfully and the zip folder is located : " + zipFolderPath); } catch (ParseException exp) { System.out.println(exp.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Records downloader ", options); } catch (RepresentationNotFoundException ex) { System.out.println(ex.getMessage()); } catch (MimeTypeException e) { System.out.println("The downloaded records have unrecognised mimeType"); } catch (ZipException e) { System.out.println("Exception happened during zipping the folder " + e.getMessage()); try { if (zipFolderPath != null) FileUtils.forceDelete(new File(zipFolderPath)); } catch (IOException io) { System.out.println("An Exception happened while deleting folder " + zipFolderPath); } } catch (NumberFormatException e) { System.out.println("Threads count should be integer"); } catch (DriverException e) { System.out.println("An exception happened during communicating with MCS: " + cmd.getOptionValue(MCS_URL) + " caused by " + e.getMessage()); } catch (InterruptedException | ExecutionException e) { System.out.println("An exception happened during downloading the files caused by: " + e.getMessage()); } catch (Exception e) { System.out.println("An exception happened caused by: " + e.getMessage()); } }
Source:
<code>public void trade() { HashMap<String, Stock> stockList = m.getStockList(); Set<String> <START> stk = <END> stockList.keySet(); String[] stocks = stk.toArray(new String[stk.size()]); for (String sym : stocks) { ArrayList<Order> supply = sellOrders.get(sym); ArrayList<Order> demand = buyOrders.get(sym); if(supply != null && demand != null && supply.size() > 0 && demand.size() > 0) { sortByPrice(supply); sortByPrice(demand); Collections.reverse(supply); int cumSupplySize = 0; int cumDemandSize = 0; HashMap<Double, Integer> minSizeSupply = new HashMap<Double, Integer>(); HashMap<Double, Integer> minSizeDemand = new HashMap<Double, Integer>(); ArrayList<Double> prices = new ArrayList<Double>(); int d = genMinShare(supply, cumSupplySize, minSizeSupply, prices); getMinShare(demand, cumDemandSize, minSizeDemand, prices, d); int i; double marketPrice = highestMinShare(minSizeSupply, minSizeDemand, prices); updateStockPriceAfterTrade(sym, marketPrice); if (marketPrice == 0.0) marketPrice = calculateAverageMarketPrice(prices); matchingPrice(supply, marketPrice); sellOrders.put(sym, supply); i = 0; while (i < demand.size()) { Order potentialOrder = demand.get(i); if (potentialOrder.getPrice() >= marketPrice) { try { (potentialOrder.getTrader()).tradePerformed(potentialOrder, marketPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } demand.remove(i); } i++; } buyOrders.put(sym, demand); } } }</code><technical_language>Rename stockListKeys</technical_language>

Target:
public void trade() { HashMap<String, Stock> stockList = m.getStockList(); Set<String> stk = stockList.keySet(); String[] stocks = stockListKeys.toArray(new String[stk.size()]); for (String sym : stocks) { ArrayList<Order> supply = sellOrders.get(sym); ArrayList<Order> demand = buyOrders.get(sym); if(supply != null && demand != null && supply.size() > 0 && demand.size() > 0) { sortByPrice(supply); sortByPrice(demand); Collections.reverse(supply); int cumSupplySize = 0; int cumDemandSize = 0; HashMap<Double, Integer> minSizeSupply = new HashMap<Double, Integer>(); HashMap<Double, Integer> minSizeDemand = new HashMap<Double, Integer>(); ArrayList<Double> prices = new ArrayList<Double>(); int d = genMinShare(supply, cumSupplySize, minSizeSupply, prices); getMinShare(demand, cumDemandSize, minSizeDemand, prices, d); int i; double marketPrice = highestMinShare(minSizeSupply, minSizeDemand, prices); updateStockPriceAfterTrade(sym, marketPrice); if (marketPrice == 0.0) marketPrice = calculateAverageMarketPrice(prices); matchingPrice(supply, marketPrice); sellOrders.put(sym, supply); i = 0; while (i < demand.size()) { Order potentialOrder = demand.get(i); if (potentialOrder.getPrice() >= marketPrice) { try { (potentialOrder.getTrader()).tradePerformed(potentialOrder, marketPrice); } catch (StockMarketExpection e) { e.printStackTrace(); } demand.remove(i); } i++; } buyOrders.put(sym, demand); } } }
Source:
<code>public static void reset(boolean retainBookmarkedPosts) { SQLiteDatabase db = getWritableDb(); if (retainBookmarkedPosts && ReaderPostTable.hasBookmarkedPosts()) { ReaderTagList tags = ReaderTagTable.getBookmarkTags(); if (!tags.isEmpty()) { <START> ReaderPostList bookmarkedPosts = ReaderPostTable.getPostsWithTag(tags.get(0), 0, true); <END> db.beginTransaction(); try { getDatabase().reset(db); ReaderPostTable.addOrUpdatePosts(tags.get(0), bookmarkedPosts); db.setTransactionSuccessful(); } finally { db.endTransaction(); } return; } } getDatabase().reset(db); }</code><technical_language>want set "excludeTextColumn" parameter false need text for offline support. wdyt</technical_language>

Target:
public static void reset(boolean retainBookmarkedPosts) { SQLiteDatabase db = getWritableDb(); if (retainBookmarkedPosts && ReaderPostTable.hasBookmarkedPosts()) { ReaderTagList tags = ReaderTagTable.getBookmarkTags(); if (!tags.isEmpty()) { ReaderPostList bookmarkedPosts = ReaderPostTable.getPostsWithTag(tags.get(0), 0, false); db.beginTransaction(); try { getDatabase().reset(db); ReaderPostTable.addOrUpdatePosts(tags.get(0), bookmarkedPosts); db.setTransactionSuccessful(); } finally { db.endTransaction(); } return; } } getDatabase().reset(db); }
Source:
<code>static public String encode(final byte[] bytes) { <START> return BaseEncoding.base32().encode(bytes); <END> }</code><technical_language>output change here: original: Base32.encode("a".getBytes()) => "ME" new: Base32.encode("a".getBytes()) => "ME======" need omitPadding() ensure this is exact drop in replacement</technical_language>

Target:
static public String encode(final byte[] bytes) { return BaseEncoding.base32() .omitPadding() .lowerCase() .encode(bytes) .toUpperCase(); }
Source:
<code>public void setStyle(S style) { <START> this.style = style; <END> }</code><technical_language>fix this in a commit elsewhere, a setter this object is longer immutable</technical_language>

Target:
public StyledText<S> setStyle(S style) { return new StyledText<>(text, style); }
Source:
<code>public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { <START> IFile featureFile = project.getFile("feature.xml"); <END> if (featureFile.exists()) { WorkspaceFeatureModel workspaceFeatureModel = new WorkspaceFeatureModel(featureFile); workspaceFeatureModel.load(); return workspaceFeatureModel.isLoaded(); } return featureFile.exists(); }</code><technical_language>warning for missing non-nls. Isnt' a constant for that</technical_language>

Target:
public boolean canConfigure(IProject project, Set<IPath> ignoredDirectories, IProgressMonitor monitor) { IFile featureFile = project.getFile(ICoreConstants.FEATURE_FILENAME_DESCRIPTOR); if (featureFile.exists()) { WorkspaceFeatureModel workspaceFeatureModel = new WorkspaceFeatureModel(featureFile); workspaceFeatureModel.load(); return workspaceFeatureModel.isLoaded(); } return featureFile.exists(); }
Source:
<code>public void onMatch(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); final RelNode input = aggregate.getInput(); final RelMetadataQuery mq = call.getMetadataQuery(); if (!SqlFunctions.isTrue(mq.areColumnsUnique(input, aggregate.getGroupSet()))) { return; } final RelBuilder relBuilder = call.builder(); final RexBuilder rexBuilder = relBuilder.getRexBuilder(); final List<RexNode> projects = new ArrayList<>(); for (AggregateCall aggCall : aggregate.getAggCallList()) { final SqlAggFunction aggregation = aggCall.getAggregation(); if (aggregation.getKind() == SqlKind.SUM0) { return; } final SqlSplittableAggFunction splitter = Objects.requireNonNull( aggregation.unwrap(SqlSplittableAggFunction.class)); final RexNode singleton = splitter.singleton( rexBuilder, input.getRowType(), aggCall); projects.add(singleton); } final RelNode newInput = convert(input, aggregate.getTraitSet().simplify()); relBuilder.push(newInput); if (!projects.isEmpty()) { projects.addAll(0, relBuilder.fields(aggregate.getGroupSet())); relBuilder.project(projects); } else if (newInput.getRowType().getFieldCount() > aggregate.getRowType().getFieldCount()) { relBuilder.project(relBuilder.fields(aggregate.getGroupSet())); } call.getPlanner().setImportance(aggregate, 0d); <START> call.transformTo(relBuilder.build()); <END> }</code><technical_language>need this change</technical_language>

Target:
public void onMatch(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); final RelNode input = aggregate.getInput(); final RelMetadataQuery mq = call.getMetadataQuery(); if (!SqlFunctions.isTrue(mq.areColumnsUnique(input, aggregate.getGroupSet()))) { return; } final RelBuilder relBuilder = call.builder(); final RexBuilder rexBuilder = relBuilder.getRexBuilder(); final List<RexNode> projects = new ArrayList<>(); for (AggregateCall aggCall : aggregate.getAggCallList()) { final SqlAggFunction aggregation = aggCall.getAggregation(); if (aggregation.getKind() == SqlKind.SUM0) { return; } final SqlSplittableAggFunction splitter = Objects.requireNonNull( aggregation.unwrap(SqlSplittableAggFunction.class)); final RexNode singleton = splitter.singleton( rexBuilder, input.getRowType(), aggCall); projects.add(singleton); } final RelNode newInput = convert(input, aggregate.getTraitSet().simplify()); relBuilder.push(newInput); if (!projects.isEmpty()) { projects.addAll(0, relBuilder.fields(aggregate.getGroupSet())); relBuilder.project(projects); } else if (newInput.getRowType().getFieldCount() > aggregate.getRowType().getFieldCount()) { relBuilder.project(relBuilder.fields(aggregate.getGroupSet())); } call.transformTo(relBuilder.build()); }
Source:
<code>public boolean hasNext() { final boolean first = this.left.hasNext(); final boolean second = this.right.hasNext(); <START> return first || second; <END> }</code><technical_language>this implementation is effective, call hasNext() methods always, call is sufficient return true. return hasNext() || hasNext()</technical_language>

Target:
public boolean hasNext() { return this.left.hasNext() || this.right.hasNext(); }
Source:
<code>public void configureChannels() throws OwException { Thing thing = callback.getThing(); OwDynamicStateDescriptionProvider dynamicStateDescriptionProvider = callback .getDynamicStateDescriptionProvider(); for (Integer i = 0; i < ioConfig.size(); i++) { String channelId = ioConfig.get(i).getChannelId(); Channel channel = thing.getChannel(channelId); if (channel != null) { Configuration channelConfig = channel.getConfiguration(); try { if (channelConfig.get(CONFIG_DIGITAL_MODE) != null) { ioConfig.get(i).setIoMode((String) channelConfig.get(CONFIG_DIGITAL_MODE)); } if (channelConfig.get(CONFIG_DIGITAL_LOGIC) != null) { ioConfig.get(i).setIoLogic((String) channelConfig.get(CONFIG_DIGITAL_LOGIC)); } } catch (IllegalArgumentException e) { throw new OwException(channelId + " has invalid configuration"); } if (dynamicStateDescriptionProvider != null) { dynamicStateDescriptionProvider.setDescription(ioConfig.get(i).getChannelUID(), new StateDescription(null, null, null, null, ioConfig.get(i).isInput(), null)); } else { <START> logger.info( <END> "state description may be inaccurate, state description provider not available in thing {}", thing.getUID()); } logger.debug("configured channel {}: {}", thing.getUID(), i, ioConfig.get(i)); } else { throw new OwException(channelId + " not found"); } } isConfigured = true; }</code><technical_language>reduce debug</technical_language>

Target:
public void configureChannels() throws OwException { Thing thing = callback.getThing(); OwDynamicStateDescriptionProvider dynamicStateDescriptionProvider = callback .getDynamicStateDescriptionProvider(); for (Integer i = 0; i < ioConfig.size(); i++) { String channelId = ioConfig.get(i).getChannelId(); Channel channel = thing.getChannel(channelId); if (channel != null) { Configuration channelConfig = channel.getConfiguration(); try { if (channelConfig.get(CONFIG_DIGITAL_MODE) != null) { ioConfig.get(i).setIoMode((String) channelConfig.get(CONFIG_DIGITAL_MODE)); } if (channelConfig.get(CONFIG_DIGITAL_LOGIC) != null) { ioConfig.get(i).setIoLogic((String) channelConfig.get(CONFIG_DIGITAL_LOGIC)); } } catch (IllegalArgumentException e) { throw new OwException(channelId + " has invalid configuration"); } if (dynamicStateDescriptionProvider != null) { dynamicStateDescriptionProvider.setDescription(ioConfig.get(i).getChannelUID(), new StateDescription(null, null, null, null, ioConfig.get(i).isInput(), null)); } else { logger.debug( "state description may be inaccurate, state description provider not available in thing {}", thing.getUID()); } logger.debug("configured channel {}: {}", thing.getUID(), i, ioConfig.get(i)); } else { throw new OwException(channelId + " not found"); } } isConfigured = true; }
Source:
<code>public HttpCacheEntry getEntry(String key) throws IOException { searcherManager.maybeReopen(); IndexSearcher searcher = searcherManager.acquire(); try { Query query = new TermQuery(new Term(KEY_FIELD_NAME, key)); TopDocs topDocs = searcher.search(query, 1); if (topDocs.totalHits > 1) { <START> System.err.println("topDocs.totalHits > 1"); <END> throw new IOException("Corrupt index (cache key is not unique)"); } ScoreDoc[] scoreDocs = topDocs.scoreDocs; if (scoreDocs.length > 0) { ScoreDoc scoreDoc = scoreDocs[0]; Document document = searcher.doc(scoreDoc.doc); return fromLuceneFields(document.getFields()); } else { return null; } } finally { searcherManager.release(searcher); } }</code><technical_language>remove debug output</technical_language>

Target:
public HttpCacheEntry getEntry(String key) throws IOException { searcherManager.maybeReopen(); IndexSearcher searcher = searcherManager.acquire(); try { Query query = new TermQuery(new Term(KEY_FIELD_NAME, key)); TopDocs topDocs = searcher.search(query, 1); if (topDocs.totalHits > 1) { throw new IOException("Corrupt index (cache key is not unique)"); } ScoreDoc[] scoreDocs = topDocs.scoreDocs; if (scoreDocs.length > 0) { ScoreDoc scoreDoc = scoreDocs[0]; Document document = searcher.doc(scoreDoc.doc); return fromLuceneFields(document.getFields()); } else { return null; } } finally { searcherManager.release(searcher); } }
Source:
<code>public ResultSet runQuery(String queryStr) throws TskCoreException { ResultSet resultSet = null; try { resultSet = statement.executeQuery(queryStr); } catch (SQLException ex) { <START> throw new TskCoreException("Error running app SQLite query. " + ex.getMessage(), ex); <END> } return resultSet; }</code><technical_language>wrap a TskCoreException? query is run case database. Furthermore, client need catch a SQLException in order interact ResultSet</technical_language>

Target:
public ResultSet runQuery(String queryStr) throws SQLException { ResultSet resultSet = null; if (null != queryStr) { resultSet = statement.executeQuery(queryStr); } return resultSet; }
Source:
<code>public void testTranslateServiceCreationConfiguration() { Jsr107ServiceConfigurationParser configTranslator = new Jsr107ServiceConfigurationParser(); Map<String, String> templateMap = new ConcurrentHashMap<>(); templateMap.put("testCache", "simpleCacheTemplate"); templateMap.put("testCache1", "simpleCacheTemplate1"); boolean jsr107CompliantAtomics = true; Jsr107Configuration serviceCreationConfiguration = new Jsr107Configuration("tiny-template", templateMap, jsr107CompliantAtomics, ConfigurationElementState.ENABLED, ConfigurationElementState.DISABLED); Node retElement = configTranslator.unparseServiceCreationConfiguration(serviceCreationConfiguration); <START> assertThat(retElement, is(notNullValue())); <END> checkAttributeItems(retElement); assertThat(retElement.getNodeName(), is("jsr107:defaults")); assertThat(retElement.getFirstChild(), is(notNullValue())); checkCaches(retElement.getFirstChild()); assertThat(retElement.getLastChild(), is(notNullValue())); checkCaches(retElement.getLastChild()); }</code><technical_language>putting null check in checkAttributeItems</technical_language>

Target:
public void testTranslateServiceCreationConfiguration() { Jsr107ServiceConfigurationParser configTranslator = new Jsr107ServiceConfigurationParser(); Map<String, String> templateMap = new HashMap<>(); templateMap.put("testCache", "simpleCacheTemplate"); templateMap.put("testCache1", "simpleCacheTemplate1"); boolean jsr107CompliantAtomics = true; Jsr107Configuration serviceCreationConfiguration = new Jsr107Configuration("tiny-template", templateMap, jsr107CompliantAtomics, ConfigurationElementState.ENABLED, ConfigurationElementState.DISABLED); Node retElement = configTranslator.unparseServiceCreationConfiguration(serviceCreationConfiguration); assertThat(retElement, is(notNullValue())); assertAttributeItems(retElement); assertThat(retElement.getNodeName(), is("jsr107:defaults")); assertThat(retElement.getFirstChild(), is(notNullValue())); assertCaches(retElement.getFirstChild()); assertThat(retElement.getLastChild(), is(notNullValue())); assertCaches(retElement.getLastChild()); }
Source:
<code>private void checkErrorLimit(double errorRateLimit) { <START> if (errorRateLimit < errPct * 100) { <END> double exceededErrorRate = errPct * 100 - errorRateLimit; resultsErrorMessage += "Error rate is " + String.format("%.2f", exceededErrorRate) + "percent higher than the threshold."; } }</code><technical_language>errPct a percentage? need multiply 100</technical_language>

Target:
private void checkErrorLimit(double errorRateLimit) { if (errorRateLimit < errorPct) { double exceededErrorRate = errorPct - errorRateLimit; resultsErrorMessage += "Error rate is " + String.format("%.2f", exceededErrorRate) + "% higher than the specified threshold. "; } }
Source:
<code>public BytesReference source(DocumentModel doc) throws IOException { BytesStreamOutput out = new BytesStreamOutput(); <START> try(JsonGenerator jsonGen = jsonFactory.createGenerator(out)) { <END> jsonESDocumentWriter.writeESDocument(jsonGen, doc, null, null); return out.bytes(); } }</code><technical_language>Space (</technical_language>

Target:
public BytesReference source(DocumentModel doc) throws IOException { BytesStreamOutput out = new BytesStreamOutput(); try (JsonGenerator jsonGen = JSON_FACTORY.createGenerator(out)) { jsonESDocumentWriter.writeESDocument(jsonGen, doc, null, null); return out.bytes(); } }
Source:
<code>public void testFindWorkingVersionFile() throws Exception{ String folderName = "/testOldFile"+UUIDGenerator.generateUuid(); Folder ff = APILocator.getFolderAPI().createFolders(folderName, host, user, false); java.io.File tmp=new java.io.File(APILocator.getFileAPI().getRealAssetPathTmpBinary()+java.io.File.separator+"testOldFile"); if(!tmp.exists()) tmp.mkdirs(); java.io.File data=new java.io.File(tmp, "test-"+UUIDGenerator.generateUuid()+".txt"); FileWriter fw=new FileWriter(data,true); fw.write("file content"); fw.close(); File file = new File(); file.setFileName("legacy.txt"); file.setFriendlyName("legacy.txt"); file.setMimeType("text/plain"); file.setTitle("legacy.txt"); file.setSize((int)data.length()); file.setModUser(user.getUserId()); file.setModDate(Calendar.getInstance().getTime()); <START> file = APILocator.getFileAPI().saveFile(file, data, ff, user, false); <END> Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(file.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),file.getTitle()); assertEquals(verAPI.getInode(),file.getInode()); APILocator.getFileAPI().delete(file, user, false); APILocator.getFolderAPI().delete(ff, user, false); }</code><technical_language>Code line 137 154 extracted a private method (createLegacyFile) reused in testFindLiveVersionFile test leave test shorter cleaner</technical_language>

Target:
public void testFindWorkingVersionFile() throws Exception{ File file = createLegacyFile(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(file.getIdentifier(), user, false); assertEquals(verAPI.getTitle(),file.getTitle()); assertEquals(verAPI.getInode(),file.getInode()); Folder folder = APILocator.getFileAPI().getFileFolder(file, host, user, false); APILocator.getFileAPI().delete(file, user, false); APILocator.getFolderAPI().delete(folder, user, false); }
Source:
<code>private List<Medication> mergeMedications( @Nonnull final List<Medication> storedMeds, @Nonnull final List<Medication> newMeds) { return storedMeds.get(0).getName() == null <START> ? Stream.of(storedMeds, newMeds).flatMap(Collection::stream).collect(Collectors.toList()) <END> : newMeds; }</code><technical_language>returning new array of storedMeds.addAll(newMeds) more simple in case, if want merge them</technical_language>

Target:
private List<Medication> mergeMedications( @Nonnull final List<Medication> storedMeds, @Nonnull final List<Medication> newMeds) { if (storedMeds.get(0).getName() == null) { final List<Medication> mergedMeds = new ArrayList<>(storedMeds); mergedMeds.addAll(newMeds); return mergedMeds; } else { return newMeds; } }
Source:
<code>public PluginClassLoader pluginClassLoader(String name) { if (PluginUtils.shouldLoadInIsolation(name)) { SortedMap<PluginDesc<?>, ClassLoader> inner = pluginLoaders.get(name); if (inner != null) { ClassLoader pluginLoader = inner.get(inner.lastKey()); <START> if (pluginLoader instanceof PluginClassLoader) { <END> return (PluginClassLoader) pluginLoader; } } } return null; }</code><technical_language>This check is interesting. Based plugin loader-specific error message in connectorLoader included this PR, fine add here. However, out of curiosity, is this strictly necessary for bug fix, if so, breaks if included</technical_language>

Target:
public PluginClassLoader pluginClassLoader(String name) { if (!PluginUtils.shouldLoadInIsolation(name)) { return null; } SortedMap<PluginDesc<?>, ClassLoader> inner = pluginLoaders.get(name); if (inner == null) { return null; } ClassLoader pluginLoader = inner.get(inner.lastKey()); return pluginLoader instanceof PluginClassLoader ? (PluginClassLoader) pluginLoader : null; }
Source:
<code>private void onBlockMovedMsg(final MigrationMsg msg) { final String operationId = msg.getOperationId().toString(); final BlockMovedMsg blockMovedMsg = msg.getBlockMovedMsg(); final int blockId = blockMovedMsg.getBlockId(); Span detached = null; try (final TraceScope onBlockMovedMsgScope = Trace.startSpan( String.format("on_block_moved_msg. blockId: %d", blockId), HTraceUtils.fromAvro(msg.getTraceInfo()))) { final boolean ownershipMsgArrivedFirst; synchronized (this) { <START> ownershipMsgArrivedFirst = ownershipAckMsgArrivedBlockIds.contains(blockId); <END> if (!ownershipMsgArrivedFirst) { detached = onBlockMovedMsgScope.detach(); blockMovedMsgArrivedBlockIds.put(blockId, Optional.ofNullable(TraceInfo.fromSpan(detached))); } else { ownershipAckMsgArrivedBlockIds.remove(blockId); } } if (ownershipMsgArrivedFirst) { handleBlockMovedMsg(operationId, blockId, TraceInfo.fromSpan(onBlockMovedMsgScope.getSpan())); } } finally { Trace.continueSpan(detached).close(); } }</code><technical_language>I slightly easier placing in-order case first: final boolean ownershipMsgArrivedFirst; // If true, messages arrived in order synchronized (this) { ownershipMsgArrivedFirst = ownershipAckMsgArrivedBlockIds.contains(blockId); if (ownershipMsgArrivedFirst) { ownershipAckMsgArrivedBlockIds.remove(blockId); } else { detached = onBlockMovedMsgScope.detach(); // traceInfo is null, if onBlockMovedMsgScope is NullScope blockMovedMsgArrivedBlockIds.put(blockId, Optional.ofNullable(TraceInfo.fromSpan(detached))); } } if (ownershipMsgArrivedFirst) { ... }</technical_language>

Target:
private void onBlockMovedMsg(final MigrationMsg msg) { final String operationId = msg.getOperationId().toString(); final BlockMovedMsg blockMovedMsg = msg.getBlockMovedMsg(); final int blockId = blockMovedMsg.getBlockId(); Span detached = null; try (final TraceScope onBlockMovedMsgScope = Trace.startSpan( String.format("on_block_moved_msg. blockId: %d", blockId), HTraceUtils.fromAvro(msg.getTraceInfo()))) { final boolean ownershipMsgArrivedFirst; synchronized (this) { ownershipMsgArrivedFirst = ownershipAckMsgArrivedBlockIds.contains(blockId); if (ownershipMsgArrivedFirst) { ownershipAckMsgArrivedBlockIds.remove(blockId); } else { detached = onBlockMovedMsgScope.detach(); blockMovedMsgArrivedBlockIds.put(blockId, Optional.ofNullable(TraceInfo.fromSpan(detached))); } } if (ownershipMsgArrivedFirst) { processBlockMovedMsg(operationId, blockId, TraceInfo.fromSpan(onBlockMovedMsgScope.getSpan())); } } finally { Trace.continueSpan(detached).close(); } }
Source:
<code>protected static long copy(final InputStream input, final OutputStream output) throws IOException { <START> final byte[] buffer = new byte[8024]; <END> long count = 0; int n; while ((n = input.read(buffer)) != -1) { output.write(buffer, 0, n); count += n; } return count; }</code><technical_language>8192? 8024 a strange number</technical_language>

Target:
protected static long copy(final InputStream input, final OutputStream output) throws IOException { final byte[] buffer = new byte[8*1024]; long count = 0; int n; while ((n = input.read(buffer)) != -1) { output.write(buffer, 0, n); count += n; } return count; }
Source:
<code>static Request fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest) throws IOException { <START> String methodName = fieldCapabilitiesRequest.indexFilter() != null ? HttpPut.METHOD_NAME : HttpGet.METHOD_NAME; <END> Request request = new Request(methodName, endpoint(fieldCapabilitiesRequest.indices(), "_field_caps")); Params params = new Params(); params.withFields(fieldCapabilitiesRequest.fields()); params.withIndicesOptions(fieldCapabilitiesRequest.indicesOptions()); request.addParameters(params.asMap()); if (fieldCapabilitiesRequest.indexFilter() != null) { request.setEntity(createEntity(fieldCapabilitiesRequest, REQUEST_BODY_CONTENT_TYPE)); } return request; }</code><technical_language>PUT? a POST</technical_language>

Target:
static Request fieldCaps(FieldCapabilitiesRequest fieldCapabilitiesRequest) throws IOException { String methodName = fieldCapabilitiesRequest.indexFilter() != null ? HttpPost.METHOD_NAME : HttpGet.METHOD_NAME; Request request = new Request(methodName, endpoint(fieldCapabilitiesRequest.indices(), "_field_caps")); Params params = new Params(); params.withFields(fieldCapabilitiesRequest.fields()); params.withIndicesOptions(fieldCapabilitiesRequest.indicesOptions()); request.addParameters(params.asMap()); if (fieldCapabilitiesRequest.indexFilter() != null) { request.setEntity(createEntity(fieldCapabilitiesRequest, REQUEST_BODY_CONTENT_TYPE)); } return request; }
Source:
<code>public String[] getSortFieldPieces(int i) { String sortField = getSortField(i); if(sortField == null ) {return new String[0];} else { sortField = StringUtils.normalize(sortField); <START> return sortField.split(" "); <END> } }</code><technical_language>\s+</technical_language>

Target:
public String[] getSortFieldPieces(int i) { String sortField = getSortField(i); if(sortField == null ) {return new String[0];} else { sortField = StringUtils.normalize(sortField); return sortField.split("\\s+"); } }
Source:
<code>private void broadcastIfAllReceiversAreInitialized() { if (numInitializedReceivers == totalNumReceivers) { initialized = true; LOG.log(Level.INFO, "All receivers are initialized"); if (stateMachine.compareAndSetState(INIT, CAN_SEND)) { <START> throw new RuntimeException("The expected current state is different from the actual state"); <END> } for (final String senderId : initializedSenderIdList) { sendSenderCanSendMessage(senderId); } iterationStartTime = System.currentTimeMillis(); } }</code><technical_language>exception messages do information expected state actual state are</technical_language>

Target:
private void broadcastIfAllReceiversAreInitialized() { if (numInitializedReceivers == totalNumReceivers) { initialized = true; LOG.log(Level.INFO, "All receivers are initialized"); if (stateMachine.compareAndSetState(INIT, CAN_SEND)) { throw new RuntimeException("The expected current state [" + INIT + "] is different from the actual state"); } for (final String senderId : initializedSenderIdList) { sendSenderCanSendMessage(senderId); } iterationStartTime = System.currentTimeMillis(); } }
Source:
<code>void loadBuildHostData(@NotNull Properties properties) { String buildHost = null; try { buildHost = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { <START> log("Unable to get build host"); <END> } put(properties, BUILD_HOST, buildHost); }</code><technical_language>more informative so: "Unable get build host, skipping " + BUILD_HOST + " value..."</technical_language>

Target:
void loadBuildHostData(@NotNull Properties properties) { String buildHost = null; try { buildHost = InetAddress.getLocalHost().getHostName(); } catch (UnknownHostException e) { log("Unable to get build host, skipping property " + BUILD_HOST + ". Error message was: " + e.getMessage()); } put(properties, BUILD_HOST, buildHost); }
Source:
<code>private <T> List<T> filterNonNullElementsAsList(T[] elements) { <START> List<T> candidateElements = new ArrayList<T>(); <END> if (elements != null) { for (T element : elements) { if (element != null) { candidateElements.add(element); } } } return Collections.unmodifiableList(candidateElements); }</code><technical_language>Add some whitespace. Outer if inverted exit early</technical_language>

Target:
private <T> List<T> filterNonNullElementsAsList(T[] elements) { if (elements == null) { return Collections.emptyList(); } List<T> candidateElements = new ArrayList<T>(); for (T element : elements) { if (element != null) { candidateElements.add(element); } } return Collections.unmodifiableList(candidateElements); }
Source:
<code>public void setBackgroundText() { OCFileListFragment ocFileListFragment = getListOfFilesFragment(); if (ocFileListFragment != null) { if (mSelectAllMenuItem != null) { mSelectAllMenuItem.setVisible(true); if (ocFileListFragment.getNoOfItems() == 0) { mSelectAllMenuItem.setVisible(false); } } int message = R.string.file_list_loading; if (!mSyncInProgress) { <START> if(mOnlyAvailableOffline){ <END> message = R.string.file_list_empty_available_offline ; }else{ message = R.string.file_list_empty; } ocFileListFragment.getProgressBar().setVisibility(View.GONE); ocFileListFragment.getShadowView().setVisibility(View.VISIBLE); } ocFileListFragment.setMessageForEmptyList(getString(message)); } else { Log_OC.e(TAG, "OCFileListFragment is null"); } }</code><technical_language>do in line ternary operator: message = mOnlyAvailableOffline ? R.string.file_list_empty_available_offline : R.string.file_list_empty;</technical_language>

Target:
public void setBackgroundText() { OCFileListFragment ocFileListFragment = getListOfFilesFragment(); if (ocFileListFragment != null) { if (mSelectAllMenuItem != null) { mSelectAllMenuItem.setVisible(true); if (ocFileListFragment.getNoOfItems() == 0) { mSelectAllMenuItem.setVisible(false); } } int message = R.string.file_list_loading; if (!mSyncInProgress) { message = mOnlyAvailableOffline ? R.string.file_list_empty_available_offline : R.string.file_list_empty; ocFileListFragment.getProgressBar().setVisibility(View.GONE); ocFileListFragment.getShadowView().setVisibility(View.VISIBLE); } ocFileListFragment.setMessageForEmptyList(getString(message)); } else { Log_OC.e(TAG, "OCFileListFragment is null"); } }
Source:
<code>public void setDistancePerPulse(double distancePerPulse) { this.distancePerPulse = distancePerPulse; <START> for (CustomEncoder encoder : encoders) { <END> encoder.setDistancePerPulse(distancePerPulse); } }</code><technical_language>Enhanced for loop</technical_language>

Target:
public void setDistancePerPulse(double distancePerPulse) { this.distancePerPulse = distancePerPulse; encoders[0].setDistancePerPulse(distancePerPulse); encoders[1].setDistancePerPulse(distancePerPulse); }
Source:
<code>public void render(Context context, Boolean value, SafeHtmlBuilder sb) { String columnString; if (value == null) { value = false; } if (value) { if (trueImageUrl == null) { <START> columnString = "<div title=\"" + value + "\" ></div>"; <END> } else { columnString = "<div title=\"" + value + "\" > <img src='" + trueImageUrl + "' /> </div>"; } } else { if (falseImageUrl == null) { columnString = "<div title=\"" + value + "\" ></div>"; } else { columnString = "<div title=\"" + value + "\" > <img src='" + falseImageUrl + "' /> </div>"; } } sb.appendHtmlConstant(columnString); }</code><technical_language>a tooltip if cell display anything</technical_language>

Target:
public void render(Context context, Boolean value, SafeHtmlBuilder sb) { String columnContentString = ""; if (value == null) { value = false; } if (value && trueImageUrl != null) { columnContentString = "<img src='" + trueImageUrl + "' />"; } else if (!value && falseImageUrl != null) { columnContentString = "<img src='" + falseImageUrl + "' />"; } sb.appendHtmlConstant("<div>" + columnContentString + "</div>"); }