auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean isQueryCacheable(Query query) { // O(n) impl, but I don't think we'll ever have a million query types here START return !query.isDescending() && !unCacheable.contains(query.getType()); END } any reason for disabling cache for descending order queries ?

Target:
public boolean isQueryCacheable(Query query) { // O(n) impl, but I don't think we'll ever have a million query types here return !unCacheable.contains(query.getType()); }
Source:
public static boolean isMoeFile(IResource resource) { if(resource instanceof IFile ) { START String fileExtension = resource.getFileExtension(); return fileExtension != null && resource.getFileExtension().equals(MODEL_OBJECT_ELEMENTFILE_EXTENSION); END } return false; } Just replace all this new code with MODEL_OBJECT_ELEMENTFILE_EXTENSION.equals(resource.getFileExtension()).

Target:
public static boolean isMoeFile(IResource resource) { return resource instanceof IFile && MODEL_OBJECT_ELEMENTFILE_EXTENSION.equals(resource.getFileExtension()); }
Source:
START public Property[] getProperties() { END return m_properties.toArray(new Property[m_properties.size()]); } could we change to List<Properties> or is this API fixed?

Target:
public List<Property> getProperties() { return m_properties; }
Source:
public void setup() throws NoSuchFieldException, IllegalAccessException { // Before "onCreate", we need to record the instance count for the test START instanceCountField = OpenHelperManager.class.getDeclaredField("instanceCount"); END instanceCountField.setAccessible(true); instanceCount = instanceCountField.getInt(null); activity = Robolectric.buildActivity(OrmLiteActivity_.class).create().get(); } No need for this. The tests must be independent, hence the instance count here should be zero.

Target:
public void setup() { activity = Robolectric.buildActivity(OrmLiteActivity_.class).create().get(); }
Source:
public static Injector getInjector() { if ( injector == null ) { START injector = Guice.createInjector( new GuiceModule( emf ) ); END } return injector; } Do we need to do this here? This seems like it's creating a circular dependency of the EMF into Guice, but the EMF depends on Guice.

Target:
public static Injector getInjector() { if ( injector == null ) { injector = Guice.createInjector( new GuiceModule() ); } return injector; }
Source:
public void serialize() throws Exception { String xml = serializer.serialize(header); START System.out.println(xml); END XMLAssert.assertXpathExists("/subscriptionHeader/contentUri", xml); XMLAssert.assertXpathExists("/subscriptionHeader/packageHeader", xml); XMLAssert.assertXpathExists("/subscriptionHeader/packageHeader/name", xml); } We don't like System.out :)

Target:
public void serialize() throws Exception { String xml = serializer.serialize(header); XMLAssert.assertXpathExists("/subscriptionHeader/contentUri", xml); XMLAssert.assertXpathExists("/subscriptionHeader/packageHeader", xml); XMLAssert.assertXpathExists("/subscriptionHeader/packageHeader/name", xml); }
Source:
protected IMicroblockContainerTile getMicroblockTile(IBlockAccess world, BlockPos pos) START { END TileEntity tile = world.getTileEntity(pos); return tile instanceof IMicroblockContainerTile ? (IMicroblockContainerTile) tile : null; } Instanceof nightmare?

Target:
protected IMicroblockContainerTile getMicroblockTile(IBlockAccess world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile == null) { return null; } return getMicroblockTile(tile); }
Source:
START public void setMethod(final ZonemasterRequest.Method method) { END this.method = method.getMethod(); this.id = method.getId(); } should be a protected method

Target:
protected void setMethod(final ZonemasterRequest.Method method) { this.method = method.getMethod(); this.id = method.getId(); }
Source:
START public Dimension getFloatingItemOffset() { END if (editPart instanceof FloatingLabelEditPart) { return ((FloatingLabelEditPart) editPart).getFloatingItemOffset(); } return new Dimension(); } Multi return is forbidden.

Target:
public Dimension getFloatingItemOffset() { Dimension offset = null; if (editPart instanceof FloatingLabelEditPart) { offset = ((FloatingLabelEditPart) editPart).getFloatingItemOffset(); } return offset != null ? offset : new Dimension(); }
Source:
private static synchronized ITerminalConnector getConnector(IRemoteConnection irc) throws RemoteConnectionException { ITerminalConnector con = cons.get(irc.getAddress()); if(con == null) { con = TerminalConnectorExtension.makeTerminalConnector( "org.eclipse.ptp.remote.internal.terminal.RemoteToolsConnector"); //$NON-NLS-1$ cons.put(irc.getAddress(),con); START } else if(irc.isOpen()) { END return null; } else { irc.open(new NullProgressMonitor()); return null; } return con; } irc is not open if con is null initially. The logic here is a bit muddled.

Target:
private static synchronized ITerminalConnector getConnector(IRemoteConnection irc) throws RemoteConnectionException { ITerminalConnector con = cons.get(irc.getAddress()); if(con == null) { con = TerminalConnectorExtension.makeTerminalConnector( "org.eclipse.ptp.remote.internal.terminal.RemoteToolsConnector"); //$NON-NLS-1$ cons.put(irc.getAddress(),con); } return con; }
Source:
public long getGlobalClassLoaderId() { START return (long) ClassLoaderIdentifier.GLOBAL_ID; END } Why not declare GLOBAL_ID as a long?

Target:
public long getGlobalClassLoaderId() { return ClassLoaderIdentifier.GLOBAL_ID; }
Source:
private int getCmasSeverity() { switch (messageIdentifier) { case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY: return SmsCbCmasInfo.CMAS_SEVERITY_EXTREME; case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED: START case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY: END case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY: return SmsCbCmasInfo.CMAS_SEVERITY_SEVERE; default: return SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN; } } Even though these two are "CMAS Severe Alerts", shouldn't getCmasSeverity() still return CMAS_SEVERITY_EXTREME? Spec says "Severity of Extreme, Urgency of Expected..."

Target:
private int getCmasSeverity() { switch (messageIdentifier) { case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_IMMEDIATE_LIKELY: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_EXTREME_EXPECTED_LIKELY: return SmsCbCmasInfo.CMAS_SEVERITY_EXTREME; case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_IMMEDIATE_LIKELY: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_OBSERVED: case SmsCbConstants.MESSAGE_ID_CMAS_ALERT_SEVERE_EXPECTED_LIKELY: return SmsCbCmasInfo.CMAS_SEVERITY_SEVERE; default: return SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN; } }
Source:
public Collection<String> getAliases(final KeyStore keyStore) throws ScriptSignatureException { try { if (keyStore != null) return Collections.list(keyStore.aliases()); } catch (KeyStoreException e) { throw new ScriptSignatureException("Keystore not initialized properly. Try again.", e); } START throw new ScriptSignatureException("Keystore not initialized properly. Try again.", null); END } instead of thowing we could return an empty list

Target:
public Collection<String> getAliases(final KeyStore keyStore) { try { if (keyStore != null) return Collections.list(keyStore.aliases()); } catch (KeyStoreException e) { return null; } return null; }
Source:
public List<Expression> getExpressions() { START List<Expression> result = new ArrayList<Expression>(groupByAttributes); END result.add(expression); return result; } Type argument Expression is not need.

Target:
public List<Expression> getExpressions() { List<Expression> result = new ArrayList<>(groupByAttributes); result.add(expression); return result; }
Source:
START public boolean isIdentityProvider() { END try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES); for (ActivityInfo activityInfo : packageInfo.activities) { if (activityInfo.name.equals(IDPAccountPickerActivity.class.getName())) { return true; } } } catch (NameNotFoundException e) { SalesforceSDKLogger.e(TAG, "Exception occurred while examining application info", e); } return false; } Could we keep this API private?

Target:
private boolean isIdentityProvider() { try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES); for (ActivityInfo activityInfo : packageInfo.activities) { if (activityInfo.name.equals(IDPAccountPickerActivity.class.getName())) { return true; } } } catch (NameNotFoundException e) { SalesforceSDKLogger.e(TAG, "Exception occurred while examining application info", e); } return false; }
Source:
START public List<BlockedItem> getBlockedItems() { END return new ArrayList<BlockedItem>(snapshot.blockedProjects); } @olivergondza noted in the commit that this should not be public as it is for testing only

Target:
protected List<BlockedItem> getBlockedItems() { return new ArrayList<BlockedItem>(snapshot.blockedProjects); }
Source:
public IStatus validate(String path) { if (fTrace == null) { START return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TraceTypeHelper_ValidateNoTrace); END } return fTrace.validate(null, path); } I don't think it makes sense for the trace to be null here. We shouldn't have to create a new Message file for this case...

Target:
public IStatus validate(String path) { return fTrace.validate(null, path); }
Source:
public static boolean isTCCPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); START return isRTPFBPacket(baf) && rc == FMT; END } just wondering...is it worth putting the `rc == FMT` check first for a short-circuiting efficiency improvement?

Target:
public static boolean isTCCPacket(ByteArrayBuffer baf) { int rc = RTCPHeaderUtils.getReportCount(baf); return rc == FMT && isRTPFBPacket(baf); }
Source:
private Result waitForCompletion() throws InterruptedException, IOException { // wait for the completion Result result; START while((result = checkForCompletion()) != null) { END Thread.sleep(1000); } return result; } @bkmeneguello Are you sure that <code>!=</code> is correct?

Target:
private Result waitForCompletion() throws InterruptedException, IOException { // wait for the completion Result result; while((result = checkForCompletion()) == null) { Thread.sleep(1000); } return result; }
Source:
public void testUnderlyingReaders() throws IOException, FormatException { FakeReader reader = new FakeReader(); FileStitcher fs = new FileStitcher(reader); assertNotNull(fs.getUnderlyingReaders()); fs.setId("test_z<0-2>.fake"); assertNotNull(fs.getUnderlyingReaders()); START } END Missing fs.close()

Target:
public void testUnderlyingReaders() throws IOException, FormatException { FakeReader reader = new FakeReader(); FileStitcher fs = new FileStitcher(reader); assertNotNull(fs.getUnderlyingReaders()); fs.setId("test_z<0-2>.fake"); assertNotNull(fs.getUnderlyingReaders()); fs.close(); }
Source:
public void shouldGetDiagnosisByUuid() { START String uuid = "4e663d66-6b78-11e0-93c3-18a905e044dc"; END int diagnosisId = 1; Diagnosis diagnosis = diagnosisDAO.getDiagnosisByUuid(uuid); assertEquals(diagnosisId, (int) diagnosis.getId()); } We can get rid of these variables if they are being used in one place.

Target:
public void shouldGetDiagnosisByUuid() { Diagnosis diagnosis = diagnosisDAO.getDiagnosisByUuid("4e663d66-6b78-11e0-93c3-18a905e044dc"); assertEquals(1, (int) diagnosis.getId()); }
Source:
public void setUpCallToAction(String callToActionText) { if (callToActionText == null) { callToActionContainer.setVisibility(GONE); } else { callToActionContainer.setVisibility(VISIBLE); START callToActionTextView.setText(callToActionText); END } } I don't think the logic is necessary. We can have the default visibility as `GONE`.

Target:
public void setUpCallToAction(String callToActionText) { if (callToActionText != null) { callToActionContainer.setVisibility(VISIBLE); callToActionTextView.setText(callToActionText); } else { callToActionContainer.setVisibility(GONE); } }
Source:
START public AbstractTableViewer END getTableViewer() { return actionContext.getViewer(); } Could this be protected as well?

Target:
protected AbstractTableViewer getTableViewer() { return actionContext.getViewer(); }
Source:
START void start() { END if (!started) { log.info("Starting prefetching thread."); executorService.execute(new DefaultGetRecordsCacheDaemon()); } started = true; } This probably should be public, and in the interface.

Target:
public void start() { if (!started) { log.info("Starting prefetching thread."); executorService.execute(new DefaultGetRecordsCacheDaemon()); } started = true; }
Source:
public SymbolTableBuilder(String fullyQualifiedModuleName) { START this.fullyQualifiedModuleName = new ArrayList<>(Arrays.asList(fullyQualifiedModuleName.split("\\."))); END } Why `new ArrayList<>(`?

Target:
public SymbolTableBuilder(String fullyQualifiedModuleName) { this.fullyQualifiedModuleName = Arrays.asList(fullyQualifiedModuleName.split("\\.")); }
Source:
public long getNextTimestamp() throws TimestampIOException { long nextTS = _timestampCounter.addAndGet(TIMESTAMP_INCREMENT); START long maxTS = _maxReservedTimestamp; // avoid the double volatile read END if (nextTS > maxTS) { reserveNextBlock(nextTS); } _numTimestampsCreated.incrementAndGet(); // JMX metric return nextTS; } Double volatile read is gone. Can get rid of maxTS.

Target:
public long getNextTimestamp() throws TimestampIOException { long nextTS = _timestampCounter.addAndGet(TIMESTAMP_INCREMENT); if (nextTS > _maxReservedTimestamp) { reserveNextBlock(nextTS); } _numTimestampsCreated.incrementAndGet(); // JMX metric return nextTS; }
Source:
public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { START this.mTileCanvasViewGroup = new WeakReference<>( viewGroup ); END this.mTile = new WeakReference<>( tile ); } please remove `this.` on this line and the next

Target:
public TileRenderRunnable( TileCanvasViewGroup viewGroup, Tile tile) { mTileCanvasViewGroup = new WeakReference<>( viewGroup ); mTile = new WeakReference<>( tile ); }
Source:
public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), false, START settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) END )))); } @matthew-a-dunlap please update the docs on `:ExcludeEmailFromExport`. Thanks!

Target:
public Response viewDataverse(@PathParam("identifier") String idtf) { return allowCors(response(req -> ok( json(execCommand(new GetDataverseCommand(req, findDataverseOrDie(idtf))), settingsService.isTrueForKey(SettingsServiceBean.Key.ExcludeEmailFromExport, false) )))); }
Source:
public ResourceNotFoundException(IdString id) { START super(id.encoded()); END } Should this better be: super(id.get()) ? At least in some other places [1] we provide the decoded id to ResourceNotFoundException(String). Shouldn't it be the same in all places, either always the decoded id or always the encoded id? [1] https://gerrit-review.googlesource.com/#/c/41733/1/gerrit-server/src/main/java/com/google/gerrit/server/group/GroupsCollection.java

Target:
public ResourceNotFoundException(IdString id) { super(id.get()); }
Source:
private AppiumDriver getDriverSafe() { WebDriver driver = getDriver(); if (driver instanceof EventFiringWebDriver) { driver = ((EventFiringWebDriver) driver).getWrappedDriver(); START if (driver instanceof AppiumDriver) { END return (AppiumDriver) driver; } } throw new ClassCastException("Appium Driver can not be casted from the actual driver."); } if you use AppiumDriver<?> driver = (AppiumDriver<?>) getDriverSafe(); then there is no sense in if (driver instanceof AppiumDriver)

Target:
private WebDriver getDriverSafe() { WebDriver driver = getDriver(); if (driver instanceof EventFiringWebDriver) { driver = ((EventFiringWebDriver) driver).getWrappedDriver(); } return driver; }
Source:
public void assertSimilarity(final File actualFile, final double maxDistance) throws IOException { BufferedImage tempImg = ImageIO.read(actualFile); File tempFile = File.createTempFile("print-test", ".png"); ImageIO.write(tempImg, "png", tempFile); START assertSimilarity(ImageIO.read(tempFile), maxDistance); END } You forgot to revert that

Target:
public void assertSimilarity(final File actualFile, final double maxDistance) throws IOException { assertSimilarity(ImageIO.read(actualFile), maxDistance); }
Source:
public URI getLocationHeaderAsURI() { try { return locationHeader != null ? new URI(locationHeader) : null; } catch (URISyntaxException e) { if (LRALogger.logger.isInfoEnabled()) { START LRALogger.logger.infof("LRARecord.doEnd missing Location header on ACCEPTED response %s failed: %s", END getRequestURI(), e.getMessage()); } return null; } } Good catch. I also just spotted that a few other log messages in tryDoEnd are attribued to this. It will be clearer to just remove the LRARecord.doEnd prefix I think.

Target:
public URI getLocationHeaderAsURI() throws URISyntaxException { return locationHeader != null ? new URI(locationHeader) : null; }
Source:
public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); START KerberosHelper.loginFromKeytab(MerlinConstants.CURRENT_USER_NAME); END bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); } This seems redundant to me as we are logging in as the current user in the base class.

Target:
public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }
Source:
public View getOverflowMenuAnchor() { View view = getToolbar().findViewById(R.id.menu_overflow_button); START return getToolbar(); END } Any reason not to check value of the view?

Target:
public View getOverflowMenuAnchor() { View view = getToolbar().findViewById(R.id.menu_overflow_button); return view == null ? getToolbar() : view; }
Source:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) throws IOException { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo, null)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); START return responseInfoList; END } I thought we will catch the exception and call close() here and then rethrow

Target:
public List<ResponseInfo> sendAndPoll(List<RequestInfo> requestInfos) throws IOException { if (closed) { throw new IllegalStateException("The NetworkClient is closed."); } List<ResponseInfo> responseInfoList = new ArrayList<ResponseInfo>(); for (RequestInfo requestInfo : requestInfos) { pendingRequests.add(new RequestMetadata(time.milliseconds(), requestInfo)); } List<NetworkSend> sends = prepareSends(responseInfoList); selector.poll(POLL_TIMEOUT_MS, sends); handleSelectorEvents(responseInfoList); return responseInfoList; }
Source:
public void handleQuotaColumnVisibility() { isQuotaVisible = false; SystemTreeItemModel treeItem = (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); if (treeItem != null START && SystemTreeItemType.DataCenter.equals(treeItem.getType())) { END StoragePool storagePool = (StoragePool) treeItem.getEntity(); if (!QuotaEnforcementTypeEnum.DISABLED.equals(storagePool.getQuotaEnforcementType())) { isQuotaVisible = true; } } onDiskViewTypeChanged(); } As far as I know, enums can be used with the ==/!= operators. It's a matter of style, but I prefer them (since an instance of an enum is really the same referenced entity as the enum constant). However, you can do whatever you like, either is fine by me.

Target:
public void handleQuotaColumnVisibility() { isQuotaVisible = false; SystemTreeItemModel treeItem = (SystemTreeItemModel) CommonModel.getInstance().getSystemTree().getSelectedItem(); if (treeItem != null && SystemTreeItemType.DataCenter == treeItem.getType()) { StoragePool storagePool = (StoragePool) treeItem.getEntity(); if (QuotaEnforcementTypeEnum.DISABLED != storagePool.getQuotaEnforcementType()) { isQuotaVisible = true; } } onDiskViewTypeChanged(); }
Source:
public CompletableFuture<StaticResource> getResource(String name) { StaticResource template = templates.get(name); if (template != null) { return CompletableFuture.completedFuture(template); } return delegate .getResource(name) .exceptionally((th) -> { templates.putIfAbsent(name, null); return null; } ) START .thenApply( (file) -> { templates.putIfAbsent(name, file); return file; }); END } shouldn't you force the put? Otherwise, what is returned might be different than what's in the cache, it's also possible that doesn't matter.

Target:
public CompletableFuture<Optional<StaticResource>> getResource(String name) { Optional<StaticResource> template = templates.get(name); if (template != null) { return CompletableFuture.completedFuture(template); } return delegate .getResource(name) .exceptionally((th) -> { return Optional.empty(); } ) .thenApply( (file) -> { templates.put(name, file); return file; }); }
Source:
public void testSessionTicketsWithTLSv13AndNoKey() throws Throwable { assumeTrue(OpenSsl.isTlsv13Supported()); START assumeTrue(OpenSsl.isBoringSSL()); END testSessionTickets(SslUtils.PROTOCOL_TLS_V1_3, false); } OpenSSL also supports it in a similar way on the server-side. See SSL_OP_NO_TICKET on this page: https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_options.html.

Target:
public void testSessionTicketsWithTLSv13AndNoKey() throws Throwable { assumeTrue(OpenSsl.isTlsv13Supported()); testSessionTickets(SslUtils.PROTOCOL_TLS_V1_3, false); }
Source:
START public void setUp() { END TmfEventMatching.registerMatchObject(new TcpEventMatching()); TmfEventMatching.registerMatchObject(new TcpLttngEventMatching()); } a BeforeClass has to be static (it doesn't tell you until you actually try to run it) I was wondering why this passed Hudson, but then remembered the perf tests don't run, yet...

Target:
public static void setUp() { TmfEventMatching.registerMatchObject(new TcpEventMatching()); TmfEventMatching.registerMatchObject(new TcpLttngEventMatching()); }
Source:
protected void updateTitle(String brand) { START if (brand != null) { END IBrandManager brandManager = TasksUiPlugin.getDefault().getBrandManager(); setTitle(brandManager.getConnectorLabel(getConnector(), brand)); } } Would it make more sense to mark the brand parameter of setBrand as @NonNull instead of checking it here?

Target:
protected void updateTitle(String brand) { IBrandManager brandManager = TasksUiPlugin.getDefault().getBrandManager(); setTitle(brandManager.getConnectorLabel(getConnector(), brand)); }
Source:
public static int getSegmentForKey(Object key, Cache cache) { KeyPartitioner keyPartitioner = extractComponent(cache, KeyPartitioner.class); if (keyPartitioner != null) { return keyPartitioner.getSegment(key); } START return SegmentSpecificCommand.UNKNOWN_SEGMENT; END } I'd rather throw an exception

Target:
public static int getSegmentForKey(Object key, Cache cache) { KeyPartitioner keyPartitioner = extractComponent(cache, KeyPartitioner.class); return keyPartitioner.getSegment(key); }