auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void closeResponseChannel() { if (isOpen()) { <START> try { <END> channelWriteLock.lock(); responseChannelOpen.set(false); logger.trace("NettyResponseChannel for network channel closed", ctx.channel()); } finally { channelWriteLock.unlock(); } } }</code><technical_language>is this try-finally for</technical_language>

Target:
private void closeResponseChannel() { if (isOpen()) { channelWriteLock.lock(); try { responseChannelOpen.set(false); logger.trace("NettyResponseChannel for network channel closed", ctx.channel()); } finally { channelWriteLock.unlock(); } } }
Source:
<code>protected abstract void storageInit() throws IOException; public abstract void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException; public abstract void purgeTable(TableDesc tableDesc) throws IOException; public abstract List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException; public abstract List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException; public abstract StorageProperty getStorageProperty(); public abstract void closeStorageManager(); public abstract TupleRange[] getInsertSortRanges(OverridableConf queryContext, TableDesc tableDesc, Schema inputSchema, SortSpec[] sortSpecs, TupleRange dataRange) throws IOException; public abstract void beforeInsertOrCATS(LogicalNode node) throws IOException; <START> public abstract void queryFailed(LogicalNode node) throws IOException; <END> public StoreType getStoreType() { return storeType; }</code><technical_language>suggest rollbackOutputCommit</technical_language>

Target:
protected abstract void storageInit() throws IOException; public abstract void createTable(TableDesc tableDesc, boolean ifNotExists) throws IOException; public abstract void purgeTable(TableDesc tableDesc) throws IOException; public abstract List<Fragment> getSplits(String fragmentId, TableDesc tableDesc, ScanNode scanNode) throws IOException; public abstract List<Fragment> getNonForwardSplit(TableDesc tableDesc, int currentPage, int numFragments) throws IOException; public abstract StorageProperty getStorageProperty(); public abstract void closeStorageManager(); public abstract TupleRange[] getInsertSortRanges(OverridableConf queryContext, TableDesc tableDesc, Schema inputSchema, SortSpec[] sortSpecs, TupleRange dataRange) throws IOException; public abstract void beforeInsertOrCATS(LogicalNode node) throws IOException; public abstract void rollbackOutputCommit(LogicalNode node) throws IOException; public StoreType getStoreType() { return storeType; }
Source:
<code>void reset() { if( mState == State.PENDING_DECODE ) { if ( mTileRenderRunnableWeakReference != null ) { TileRenderRunnable runnable = mTileRenderRunnableWeakReference.get(); if( runnable != null ) { runnable.cancel( true ); } } } mState = State.UNASSIGNED; mRenderTimeStamp = null; if( mBitmap != null && !mBitmap.isRecycled() ) { BitmapRecycler recycler = mBitmapRecyclerReference.get(); if( recycler != null ) { recycler.recycleBitmap( mBitmap ); <START> } else { <END> mBitmap.recycle(); } } mBitmap = null; }</code><technical_language>drop else block - get a default recycler, if nulled out do anything... if( recycler != null ) { recycler.recycleBitmap( mBitmap ); } // done</technical_language>

Target:
void reset() { if( mState == State.PENDING_DECODE ) { if ( mTileRenderRunnableWeakReference != null ) { TileRenderRunnable runnable = mTileRenderRunnableWeakReference.get(); if( runnable != null ) { runnable.cancel( true ); } } } mState = State.UNASSIGNED; mRenderTimeStamp = null; if( mBitmap != null ) { BitmapRecycler recycler = mBitmapRecyclerReference.get(); if( recycler != null ) { recycler.recycleBitmap( mBitmap ); } } mBitmap = null; }
Source:
<code>public DefaultBoxMacro() { super("Box", DESCRIPTION, new DefaultContentDescriptor(CONTENT_DESCRIPTION, true, <START> new DefaultParameterizedType(null, List.class, Block.class)), BoxMacroParameters.class); <END> setDefaultCategory(DEFAULT_CATEGORY_FORMATTING); }</code><technical_language>new DefaultParameterizedType(null, List.class, Block.class) is a common case put in a constant somewhere. in Block</technical_language>

Target:
public DefaultBoxMacro() { super("Box", DESCRIPTION, new DefaultContentDescriptor(CONTENT_DESCRIPTION, true, Block.LIST_BLOCK_TYPE), BoxMacroParameters.class); setDefaultCategory(DEFAULT_CATEGORY_FORMATTING); }
Source:
<code>private String toCSV(Collection<String> strings) { StringBuilder strB = new StringBuilder(); strings.forEach(s -> strB.append(s).append(",")); <START> return strB.toString(); <END> }</code><technical_language>Collectors.joining instead: return strings.stream().collect(Collectors.joining(","));</technical_language>

Target:
private String toCSV(Collection<String> strings) { return strings.stream().collect(Collectors.joining(",")); }
Source:
<code>private HttpResponse executeRequest(HttpUriRequest request) throws RapidProClientException { try { generateTokenAuthHeader(request); LOGGER.debug(EXECUTING_REQUEST + request.toString()); HttpResponse response = client.execute(request); checkHttpStatusCode(response); return response; } catch (IOException e) { <START> LOGGER.error(e.getMessage()); <END> throw new RapidProClientException(UNABLE_TO_EXECUTE, e); } }</code><technical_language>logging is redundant, throw exception</technical_language>

Target:
private HttpResponse executeRequest(HttpUriRequest request) throws RapidProClientException { try { generateTokenAuthHeader(request); LOGGER.debug(EXECUTING_REQUEST + request.toString()); HttpResponse response = client.execute(request); checkHttpStatusCode(response); return response; } catch (IOException e) { throw new RapidProClientException(UNABLE_TO_EXECUTE, e); } }
Source:
<code>public static List<File> getReportsDirectories(Settings settings, FileSystem fs, PathResolver pathResolver) { File dir = getReportsDirectoryFromProperty(settings, fs, pathResolver); List<File> dirs = getReportsDirectoriesFromProperty(settings, fs, pathResolver); <START> if (dir != null ^ dirs != null) { <END> if (dirs != null) { return dirs; } return Collections.singletonList(dir); } if (dir == null) { return Collections.singletonList(new File(fs.baseDir(), "target/surefire-reports")); } LOGGER.info("Property '" + SUREFIRE_REPORTS_PATH_PROPERTY + "' is deprecated and will be ignorded, as property '" + SUREFIRE_REPORT_PATHS_PROPERTY + "' is also set."); return dirs; }</code><technical_language>I find this complicated (I ^ operator :-) ) , I I logic return ^ operator. if (dirs != null) { if (dir != null) { // properties set LOGGER.info("Property '" + SUREFIRE_REPORTS_PATH_PROPERTY + "' is deprecated ignored, property '" + SUREFIRE_REPORT_PATHS_PROPERTY + "' is set."); } return dirs; } if (dir != null) { return Collections.singletonList(dir); } // properties set return Collections.singletonList(new File(fs.baseDir(), "target/surefire-reports"));;</technical_language>

Target:
public static List<File> getReportsDirectories(Settings settings, FileSystem fs, PathResolver pathResolver) { File dir = getReportsDirectoryFromDeprecatedProperty(settings, fs, pathResolver); List<File> dirs = getReportsDirectoriesFromProperty(settings, fs, pathResolver); if (dirs != null) { if (dir != null) { LOGGER.info("Property '{}' is deprecated and will be ignored, as property '{}' is also set.", SUREFIRE_REPORTS_PATH_PROPERTY, SUREFIRE_REPORT_PATHS_PROPERTY); } return dirs; } if (dir != null) { return Collections.singletonList(dir); } return Collections.singletonList(new File(fs.baseDir(), "target/surefire-reports")); }
Source:
<code>public DefaultDmnEngineConfiguration enableFeelLegacyBehavior(boolean enableFeelLegacyBehavior) { <START> this.enableFeelLegacyBehavior = enableFeelLegacyBehavior; <END> return this; }</code><technical_language>I setEnableFeelLegacyBehavior a single point flag is changed. This lead inconsistent behaviour if a user carefull</technical_language>

Target:
public DefaultDmnEngineConfiguration enableFeelLegacyBehavior(boolean enableFeelLegacyBehavior) { setEnableFeelLegacyBehavior(enableFeelLegacyBehavior); return this; }
Source:
<code>public static String getTimeSpanToXSDuration(TimeSpan timeOffset) { String offsetStr = (timeOffset.getTotalSeconds() < 0) ? "-" : ""; <START> return String.format("%sP%sDT%sH%sM%sS", offsetStr, Math.abs(timeOffset.getDays()), <END> Math.abs(timeOffset.getHours()), Math.abs(timeOffset.getMinutes()), Math.abs(timeOffset.getSeconds()) + "." + Math.abs(timeOffset.getMilliseconds())); }</code><technical_language>I suggest concatenation of strings for faster handling</technical_language>

Target:
public static String getTimeSpanToXSDuration(TimeSpan timeOffset) { String offsetStr = (timeOffset.getTotalSeconds() < 0) ? "-" : ""; long days = Math.abs(timeOffset.getDays()); long hours = Math.abs(timeOffset.getHours()); long minutes = Math.abs(timeOffset.getMinutes()); long seconds = Math.abs(timeOffset.getSeconds()); long milliseconds = Math.abs(timeOffset.getMilliseconds()); return offsetStr + "P" + days + "DT" + hours + "H" + minutes + "M" + seconds + "." + milliseconds + "S"; }
Source:
<code>private boolean isHostNetworkUnreacable(VDS vds) { VdsDynamic vdsDynamic = vds.getDynamicData(); return ((vdsDynamic.getStatus() == VDSStatus.Down) || (vdsDynamic.getStatus() == VDSStatus.Reboot) || (vdsDynamic.getStatus() == VDSStatus.NonOperational <START> && vdsDynamic.getNonOperationalReason() == NonOperationalReason.NETWORK_UNREACHABLE)); <END> }</code><technical_language>Please remove unnecessary brackets: return vdsDynamic.getStatus() == VDSStatus.Down || vdsDynamic.getStatus() == VDSStatus.Reboot || (vdsDynamic.getStatus() == VDSStatus.NonOperational && vdsDynamic.getNonOperationalReason() == NonOperationalReason.NETWORK_UNREACHABLE); remaining brackets necessary, code more readable</technical_language>

Target:
private boolean isHostNetworkUnreacable(VDS vds) { VdsDynamic vdsDynamic = vds.getDynamicData(); return (vdsDynamic.getStatus() == VDSStatus.Down || vdsDynamic.getStatus() == VDSStatus.Reboot || (vdsDynamic.getStatus() == VDSStatus.NonOperational && vdsDynamic.getNonOperationalReason() == NonOperationalReason.NETWORK_UNREACHABLE)); }
Source:
<code>boolean checkEquality(String a, File b) { try { return a != null && b != null && new File(a).getCanonicalPath().equals(b.getCanonicalPath()); <START> } catch (IOException e) { <END> } return false; }</code><technical_language>this method throw IOException change caller accordingly</technical_language>

Target:
boolean checkEquality(String a, File b) { assertNotNull(a); assertNotNull(b); return new File(a).equals(b); }
Source:
<code>public static int getLocalIconResId(@Nullable String identifier) { if (ID_BICYCLE.equals(identifier)) { return R.drawable.ic_bicycle; } else if (ID_WALK.equals(identifier)) { return R.drawable.ic_walk; } else if (ID_PUBLIC_TRANSPORT.equals(identifier)) { return R.drawable.ic_public_transport; } else if (ID_TAXI.equals(identifier)) { return R.drawable.ic_taxi; } else if (ID_SHUTTLE_BUS.equals(identifier)) { return R.drawable.ic_shuttlebus; } else if (ID_MOTORBIKE.equals(identifier)) { return R.drawable.ic_motorbike; } else if (ID_CAR.equals(identifier)) { return R.drawable.ic_car; } else if (ID_AIR.equals(identifier)) { return R.drawable.ic_aeroplane; } else if (identifier != null && identifier.startsWith(ID_BICYCLE) && identifier.contains(MIDDLE_FIX_BIC)) { <START> return R.drawable.ic_bicycle_share; <END> } else { return 0; } }</code><technical_language>@nighthawk guys do match iOS? this icon remote icon</technical_language>

Target:
public static int getLocalIconResId(@Nullable String identifier) { if (ID_BICYCLE.equals(identifier)) { return R.drawable.ic_bicycle; } else if (ID_WALK.equals(identifier)) { return R.drawable.ic_walk; } else if (ID_PUBLIC_TRANSPORT.equals(identifier)) { return R.drawable.ic_public_transport; } else if (ID_TAXI.equals(identifier)) { return R.drawable.ic_taxi; } else if (ID_SHUTTLE_BUS.equals(identifier)) { return R.drawable.ic_shuttlebus; } else if (ID_MOTORBIKE.equals(identifier)) { return R.drawable.ic_motorbike; } else if (ID_CAR.equals(identifier)) { return R.drawable.ic_car; } else if (ID_AIR.equals(identifier)) { return R.drawable.ic_aeroplane; } else if (identifier != null && identifier.startsWith("cy_bic-s")) { return R.drawable.ic_bicycle_share; } else { return 0; } }
Source:
<code>protected void configure() { super.configure(); bindHttpApi(binder(), AuthenticationApi.class); bindHttpApi(binder(), TempAuthApi.class); <START> requestStaticInjection(SwiftAuthenticationModule.class); <END> }</code><technical_language>injected variables here, this needed</technical_language>

Target:
protected void configure() { super.configure(); bindHttpApi(binder(), AuthenticationApi.class); bindHttpApi(binder(), TempAuthApi.class); }
Source:
<code>public void run() { Thread.currentThread().setName("DataServiceImpl:Submit"); while (publisherEnabled) { long sleepingTime = -1; if (DataServiceImpl.this.dataTransportService.isConnected()) { try { DataMessage message = DataServiceImpl.this.store.getNextMessage(); if (message != null) { checkInFlightMessages(message); boolean messagePublished; if (dataServiceOptions.isRateLimitEnabled() && message.getPriority() >= 5) { messagePublished = publishMessageTokenBucket(message); } else { <START> messagePublished = publishMessageUnbound(message); <END> } if (messagePublished) { continue; } else { sleepingTime = DataServiceImpl.this.throttle.getNextRefillEta(); } } } catch (KuraNotConnectedException e) { logger.info("DataPublisherService is not connected"); } catch (KuraTooManyInflightMessagesException e) { logger.info("Too many in-flight messages"); handleInFlightCongestion(); } catch (Exception e) { logger.error("Probably an unrecoverable exception", e); } } else { logger.info("DataPublisherService not connected"); } try { suspendPublisher(sleepingTime, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { logger.debug("Interrupting publishing thread."); Thread.currentThread().interrupt(); } } logger.debug("Exited publisher loop."); }</code><technical_language>this method alway returns true set messagePublished true explicitly intialize true</technical_language>

Target:
public void run() { Thread.currentThread().setName("DataServiceImpl:Submit"); while (publisherEnabled.get()) { long sleepingTime = -1; boolean messagePublished = false; if (DataServiceImpl.this.dataTransportService.isConnected()) { try { DataMessage message = DataServiceImpl.this.store.getNextMessage(); if (message != null) { checkInFlightMessages(message); if (dataServiceOptions.isRateLimitEnabled() && message.getPriority() >= 5) { messagePublished = publishMessageTokenBucket(message); sleepingTime = DataServiceImpl.this.throttle.getTokenWaitTime(); } else { publishMessageUnbound(message); messagePublished = true; } } } catch (KuraNotConnectedException e) { logger.info("DataPublisherService is not connected"); } catch (KuraTooManyInflightMessagesException e) { logger.info("Too many in-flight messages"); handleInFlightCongestion(); } catch (Exception e) { logger.error("Probably an unrecoverable exception", e); } } else { logger.info("DataPublisherService not connected"); } if (!messagePublished) { suspendPublisher(sleepingTime, TimeUnit.MILLISECONDS); } } logger.debug("Exited publisher loop."); }
Source:
<code>protected Acceptor buildAcceptor(HeuristicConfigPolicy configPolicy) { AcceptorConfig acceptorConfig_; if (acceptorConfig != null) { if (localSearchType != null) { throw new IllegalArgumentException("The localSearchType (" + localSearchType + ") must not be configured if the acceptorConfig (" + acceptorConfig + ") is explicitly configured."); } acceptorConfig_ = acceptorConfig; } else { LocalSearchType localSearchType_ = defaultIfNull(localSearchType, LocalSearchType.LATE_ACCEPTANCE); acceptorConfig_ = new AcceptorConfig(); switch (localSearchType_) { case HILL_CLIMBING: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.HILL_CLIMBING)); break; case TABU_SEARCH: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.ENTITY_TABU)); break; case SIMULATED_ANNEALING: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.SIMULATED_ANNEALING)); break; case LATE_ACCEPTANCE: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.LATE_ACCEPTANCE)); break; case VARIABLE_NEIGHBORHOOD_DESCENT: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.HILL_CLIMBING)); <START> break; <END> default: throw new IllegalStateException("The localSearchType (" + localSearchType_ + ") is not implemented."); } } return acceptorConfig_.buildAcceptor(configPolicy); }</code><technical_language>merging this HILL_CLIMBING case? removing duplicity, obvious search algorithms share acceptor type. java case HILL_CLIMBING: case VARIABLE_NEIGHBORHOOD_DESCENT: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.HILL_CLIMBING)); break; Notice multiple case labels in forager configuration section below</technical_language>

Target:
protected Acceptor buildAcceptor(HeuristicConfigPolicy configPolicy) { AcceptorConfig acceptorConfig_; if (acceptorConfig != null) { if (localSearchType != null) { throw new IllegalArgumentException("The localSearchType (" + localSearchType + ") must not be configured if the acceptorConfig (" + acceptorConfig + ") is explicitly configured."); } acceptorConfig_ = acceptorConfig; } else { LocalSearchType localSearchType_ = defaultIfNull(localSearchType, LocalSearchType.LATE_ACCEPTANCE); acceptorConfig_ = new AcceptorConfig(); switch (localSearchType_) { case HILL_CLIMBING: case VARIABLE_NEIGHBORHOOD_DESCENT: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.HILL_CLIMBING)); break; case TABU_SEARCH: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.ENTITY_TABU)); break; case SIMULATED_ANNEALING: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.SIMULATED_ANNEALING)); break; case LATE_ACCEPTANCE: acceptorConfig_.setAcceptorTypeList(Collections.singletonList(AcceptorType.LATE_ACCEPTANCE)); break; default: throw new IllegalStateException("The localSearchType (" + localSearchType_ + ") is not implemented."); } } return acceptorConfig_.buildAcceptor(configPolicy); }
Source:
<code><START> private boolean isLambda(RowExpression rowExpression) <END> { if (isExpression(rowExpression)) { return castToExpression(rowExpression) instanceof LambdaExpression; } return rowExpression instanceof LambdaDefinitionExpression; }</code><technical_language>this a static method? Another similar methods is MultipleDistinctAggregationToMarkDistinct#toSymbol. put in a Util class? @highker</technical_language>

Target:
private static boolean isLambda(RowExpression rowExpression) { return castToExpression(rowExpression) instanceof LambdaExpression; }
Source:
<code>protected void removeChildVisual(EditPart childEditPart) { super.removeChildVisual(childEditPart); if (getContentPane().getChildren().size() == 0) { Dimension dim = <START> TextUtilities.INSTANCE.getTextExtents(Messages.InterfaceContainerEditPart_Int, <END> getContentPane().getFont()); dim.height = (int) (dim.height * 0.66); getContentPane().setPreferredSize(dim); } }</code><technical_language>this text externalized</technical_language>

Target:
protected void removeChildVisual(EditPart childEditPart) { super.removeChildVisual(childEditPart); if (getContentPane().getChildren().size() == 0) { Dimension dim = TextUtilities.INSTANCE.getTextExtents("INT", getContentPane().getFont()); dim.height = (int) (dim.height * 0.66); getContentPane().setPreferredSize(dim); } }
Source:
<code>protected void createPreparedStatement(Connection db) throws SQLException { ExpressionBuilder builder = dialect.expressionBuilder(); switch (mode) { case TABLE: builder.append("SELECT * FROM ").append(tableId); addSuffixIfPresent(builder); String queryStr = builder.toString(); recordQuery(queryStr); log.debug("{} prepared SQL query: {}", this, queryStr); stmt = dialect.createPreparedStatement(db, queryStr); break; case QUERY: addSuffixIfPresent(builder); <START> queryStr = query + builder.toString(); <END> recordQuery(queryStr); log.debug("{} prepared SQL query: {}", this, queryStr); stmt = dialect.createPreparedStatement(db, queryStr); break; default: throw new ConnectException("Unknown mode: " + mode); } }</code><technical_language>call builder.append(query); string concatenation</technical_language>

Target:
protected void createPreparedStatement(Connection db) throws SQLException { ExpressionBuilder builder = dialect.expressionBuilder(); switch (mode) { case TABLE: builder.append("SELECT * FROM ").append(tableId); break; case QUERY: builder.append(query); break; default: throw new ConnectException("Unknown mode: " + mode); } addSuffixIfPresent(builder); String queryStr = builder.toString(); recordQuery(queryStr); log.debug("{} prepared SQL query: {}", this, queryStr); stmt = dialect.createPreparedStatement(db, queryStr); }
Source:
<code>protected String classToCheck() { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>I this supposed invoked I nitpicking, accidentally happen, prefer dummy string returned exception explanation</technical_language>

Target:
protected String classToCheck() { throw new UnsupportedOperationException("touch method reimplemented in JettyContainer"); }
Source:
<code>private NotificationCompat.Builder getNotificationBuilder(GalleryItem galleryItem, Bitmap savedImage, String localUrl) { String filename = galleryItem.getName(); <START> String descriptionUrl = galleryItem.getDescriptionUrl(); <END> Intent shareChooserIntent = buildImageShareChooserIntent(app, filename, descriptionUrl, localUrl); Intent viewImageIntent = buildViewInDefaultAppIntent(localUrl); PendingIntent savedImageSharePendingIntent = getPendingIntent(shareChooserIntent); PendingIntent viewInDefaultViewerAppPendingIntent = getPendingIntent(viewImageIntent); NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle().bigPicture(savedImage); NotificationCompat.Action savedImageShareAction = buildSavedImageShareAction(savedImageSharePendingIntent); return new NotificationCompat.Builder(app) .setSmallIcon(R.drawable.launcher) .setContentTitle(getString(R.string.gallery_image_saved_notification_title)) .setContentText(getString(R.string.gallery_image_saved_notification_text)) .setContentIntent(viewInDefaultViewerAppPendingIntent) .setStyle(bigPictureStyle) .addAction(savedImageShareAction); }</code><technical_language>Actually... I need fetch description URL all. URL of actual image page is in form of "imageTitle.getCanonicalUri()". instead</technical_language>

Target:
private NotificationCompat.Builder getNotificationBuilder(GalleryItem galleryItem, Bitmap savedImage, String localUrl) { String filename = galleryItem.getName(); String descriptionUrl = imageTitle.getCanonicalUri(); Intent shareChooserIntent = buildImageShareChooserIntent(app, filename, descriptionUrl, localUrl); Intent viewImageIntent = buildViewInDefaultAppIntent(localUrl); PendingIntent savedImageSharePendingIntent = getPendingIntent(shareChooserIntent); PendingIntent viewInDefaultViewerAppPendingIntent = getPendingIntent(viewImageIntent); NotificationCompat.BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle().bigPicture(savedImage); NotificationCompat.Action savedImageShareAction = buildSavedImageShareAction(savedImageSharePendingIntent); return new NotificationCompat.Builder(app) .setSmallIcon(R.drawable.launcher) .setContentTitle(getString(R.string.gallery_image_saved_notification_title)) .setContentText(getString(R.string.gallery_image_saved_notification_text)) .setContentIntent(viewInDefaultViewerAppPendingIntent) .setStyle(bigPictureStyle) .addAction(savedImageShareAction); }
Source:
<code><START> private String getDomainIdTuple(Guid domainId) { <END> storage_domain_static storage_domain = DbFacade.getInstance().getStorageDomainStaticDAO().get(domainId); if (storage_domain != null) { return domainId + ":" + storage_domain.getstorage_name(); } else { return domainId.toString(); } }</code><technical_language>this static</technical_language>

Target:
private static String getDomainIdTuple(Guid domainId) { storage_domain_static storage_domain = DbFacade.getInstance().getStorageDomainStaticDao().get(domainId); if (storage_domain != null) { return domainId + ":" + storage_domain.getstorage_name(); } else { return domainId.toString(); } }
Source:
<code>public void shouldThrowExceptionIfChefNotExist() { when(userService.findUserById(1L)).thenReturn(empty()); chefProfileService.findChef(1L, "fe80::2dd3:fb76:73b6:c1da"); <START> } <END></code><technical_language>@qasmi ProfileViewRepository ,ProfileMonitorService tested :-1:</technical_language>

Target:
public void shouldThrowExceptionIfChefNotExist() { when(userService.findUserById(1L)).thenReturn(empty()); chefProfileService.findChef(1L); }
Source:
<code>public void updateCacheStorageTest() { <START> CacheStorageImpl cache = new CacheStorageImpl(); <END> final Map<Identifier, OperatorState> queryState1= new HashMap<>(); queryState1.put(oid1, value1); OperatorState<Integer> value3 = new OperatorState<>(10); OperatorState<String> value4 = new OperatorState<>("abcd"); cache.create(qid1, queryState1); Assert.assertEquals(value1, cache.read(qid1, oid1)); Assert.assertEquals(true, cache.update(qid1, oid1, value3)); Assert.assertEquals(value3, cache.read(qid1, oid1)); Assert.assertEquals(true, cache.update(qid1, oid1, value4)); Assert.assertEquals(value4, cache.read(qid1, oid1)); Assert.assertEquals("abcd", cache.read(qid1, oid1).getState()); Assert.assertEquals(true, cache.update(qid1, oid1, value4)); Assert.assertEquals(value4, cache.read(qid1, oid1)); Assert.assertEquals(true, cache.update(qid1, oid2, value3)); Assert.assertSame(value3, cache.read(qid1, oid2)); Assert.assertEquals(false, cache.update(qid2, oid1, value3)); Assert.assertEquals(false, cache.update(qid2, oid3, value3)); }</code><technical_language>final</technical_language>

Target:
public void updateCacheStorageTest() { final CacheStorage cache = new CacheStorageImpl(); final Map<Identifier, OperatorState> queryState1 = new HashMap<>(); queryState1.put(oid1, value1); final OperatorState<Integer> value5 = new OperatorState<>(10); final OperatorState<String> value6 = new OperatorState<>("abcd"); cache.create(qid1, queryState1); Assert.assertEquals(value1, cache.read(qid1, oid1)); Assert.assertTrue(cache.update(qid1, oid1, value5)); Assert.assertEquals(value5, cache.read(qid1, oid1)); Assert.assertTrue(cache.update(qid1, oid1, value6)); Assert.assertEquals(value6, cache.read(qid1, oid1)); Assert.assertEquals("abcd", cache.read(qid1, oid1).getState()); Assert.assertTrue(cache.update(qid1, oid1, value6)); Assert.assertEquals(value6, cache.read(qid1, oid1)); Assert.assertFalse(cache.update(qid1, oid2, value5)); Assert.assertFalse(cache.update(qid2, oid1, value5)); Assert.assertFalse(cache.update(qid2, oid3, value5)); }
Source:
<code>protected void doWork(IProgressMonitor monitor) throws OseeCoreException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", Function.PURGE_BRANCH.name()); BranchState currentState = branch.getBranchState(); BranchArchivedState archivedState = branch.getArchiveState(); ArtifactCache.deCache(branch); branch.setBranchState(BranchState.PURGE_IN_PROGRESS); branch.setArchived(true); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purging, branch.getGuid())); <START> BranchManager.persist(branch); <END> AcquireResult response = null; try { PurgeBranchRequest requestData = new PurgeBranchRequest(branch.getId(), recursive); response = HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, CoreTranslatorId.PURGE_BRANCH_REQUEST, requestData, null); } catch (OseeCoreException ex) { branch.setBranchState(currentState); branch.setArchived(archivedState.isArchived()); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branch.getGuid())); throw ex; } if (response.wasSuccessful()) { branch.setBranchState(BranchState.PURGED); branch.setArchived(true); BranchManager.decache(branch); BranchManager.getCache().reloadCache(); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purged, branch.getGuid())); } }</code><technical_language>I this persist call is needed purge request care of updating server</technical_language>

Target:
protected void doWork(IProgressMonitor monitor) throws OseeCoreException { Map<String, String> parameters = new HashMap<String, String>(); parameters.put("function", Function.PURGE_BRANCH.name()); BranchState currentState = branch.getBranchState(); BranchArchivedState archivedState = branch.getArchiveState(); ArtifactCache.deCache(branch); branch.setBranchState(BranchState.PURGE_IN_PROGRESS); branch.setArchived(true); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purging, branch.getGuid())); AcquireResult response = null; try { PurgeBranchRequest requestData = new PurgeBranchRequest(branch.getId(), recursive); response = HttpClientMessage.send(OseeServerContext.BRANCH_CONTEXT, parameters, CoreTranslatorId.PURGE_BRANCH_REQUEST, requestData, null); } catch (OseeCoreException ex) { branch.setBranchState(currentState); branch.setArchived(archivedState.isArchived()); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.StateUpdated, branch.getGuid())); throw ex; } if (response.wasSuccessful()) { branch.setBranchState(BranchState.PURGED); branch.setArchived(true); BranchManager.decache(branch); BranchManager.getCache().reloadCache(); OseeEventManager.kickBranchEvent(getClass(), new BranchEvent(BranchEventType.Purged, branch.getGuid())); } }
Source:
<code>public static void init(Configuration configuration, StramHTTPAuthentication stramHTTPAuth) { hadoopWebSecurityEnabled = false; String authValue = configuration.get(HADOOP_HTTP_AUTH_PROP); if ((authValue != null) && !authValue.equals(HADOOP_HTTP_AUTH_VALUE_SIMPLE)) { hadoopWebSecurityEnabled = true; initAuth(configuration); } <START> if (stramHTTPAuth == Context.StramHTTPAuthentication.FOLLOW_HADOOP_HTTP_AUTH) { <END> stramWebSecurityEnabled = hadoopWebSecurityEnabled; } else if (stramHTTPAuth == StramHTTPAuthentication.FOLLOW_HADOOP_AUTH) { stramWebSecurityEnabled = UserGroupInformation.isSecurityEnabled(); } else if (stramHTTPAuth == StramHTTPAuthentication.ENABLE) { stramWebSecurityEnabled = true; } else if (stramHTTPAuth == StramHTTPAuthentication.DISABLE) { stramWebSecurityEnabled = false; } }</code><technical_language>Please change StramHTTPAuthentication.FOLLOW_HADOOP_HTTP_AUTH consistent remaining if statements</technical_language>

Target:
public static void init(Configuration configuration, StramHTTPAuthentication stramHTTPAuth) { hadoopWebSecurityEnabled = false; String authValue = configuration.get(HADOOP_HTTP_AUTH_PROP); if ((authValue != null) && !authValue.equals(HADOOP_HTTP_AUTH_VALUE_SIMPLE)) { hadoopWebSecurityEnabled = true; initAuth(configuration); } if (stramHTTPAuth == StramHTTPAuthentication.FOLLOW_HADOOP_HTTP_AUTH) { stramWebSecurityEnabled = hadoopWebSecurityEnabled; } else if (stramHTTPAuth == StramHTTPAuthentication.ENABLE) { stramWebSecurityEnabled = true; } else if (stramHTTPAuth == StramHTTPAuthentication.DISABLE) { stramWebSecurityEnabled = false; } else { stramWebSecurityEnabled = UserGroupInformation.isSecurityEnabled(); } }
Source:
<code>public void getLogSegmentsNotInJournalTest() throws InterruptedException, IOException, StoreException { if (isLogSegmented) { testGetLogSegmentsNotInJournal(2, 2 * MAX_IN_MEM_ELEMENTS, false); <START> testGetLogSegmentsNotInJournal(3, 2 * MAX_IN_MEM_ELEMENTS, false); <END> } else { assertEquals("LogSegments mismatch for non segmented log ", null, state.index.getLogSegmentsNotInJournal()); } }</code><technical_language>is intent of this function call? testGetLogSegmentsNotInJournal() reduce this case tested in previous function call</technical_language>

Target:
public void getLogSegmentsNotInJournalTest() throws InterruptedException, IOException, StoreException { if (isLogSegmented) { testGetLogSegmentsNotInJournal(2, 2 * MAX_IN_MEM_ELEMENTS); testGetLogSegmentsNotInJournal(3, 2 * MAX_IN_MEM_ELEMENTS); } else { assertEquals("LogSegments mismatch for non segmented log ", null, state.index.getLogSegmentsNotInJournal()); } }
Source:
<code><START> public void testNonExistingFilePathProvided() throws Exception { <END> params = new String[1]; params[0] = "/Users/c.xml"; new SubmitJobCommand(params).execute(currentContextMock); assertThat(stack.get(0).getMessage(), is("'" + params[0] + "' does not exist.")); Mockito.verify(schedulerRestClientMock, times(0)).submitJobArchive(anyString(), anyObject(), anyObject()); throw stack.get(0); }</code><technical_language>improve naming</technical_language>

Target:
public void testNonExistingFilePathProvided() throws Exception { params = new String[1]; params[0] = "/file/not/existing/c.xml"; new SubmitJobCommand(params).execute(currentContextMock); assertThat(stack.get(0).getMessage(), is("'" + params[0] + "' does not exist.")); Mockito.verify(schedulerRestClientMock, times(0)) .submitJobArchive(anyString(), convertObjectToInputStream(anyObject()), anyMap()); throw stack.get(0); }
Source:
<code>public void onClick(View v) { if (mParentItemClickListener != null) { if (mClickableView != null) { if (mRotationEnabled) { RotateAnimation rotateAnimation = new RotateAnimation(ROTATED_POSITION, INITIAL_POSITION, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE); mRotation = INITIAL_POSITION; rotateAnimation.setDuration(mDuration); rotateAnimation.setFillAfter(true); v.startAnimation(rotateAnimation); <START> setExpanded(!mIsExpanded); <END> } } mParentItemClickListener.onParentItemClickListener(getLayoutPosition()); } }</code><technical_language>is expanded live rotation enabled if statement? if I disable rotation view need if is expanded not</technical_language>

Target:
public void onClick(View v) { if (mParentItemClickListener != null) { if (mClickableView != null) { if (mRotationEnabled) { RotateAnimation rotateAnimation = new RotateAnimation(ROTATED_POSITION, INITIAL_POSITION, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE, RotateAnimation.RELATIVE_TO_SELF, PIVOT_VALUE); mRotation = INITIAL_POSITION; rotateAnimation.setDuration(mDuration); rotateAnimation.setFillAfter(true); v.startAnimation(rotateAnimation); } } setExpanded(!mIsExpanded); mParentItemClickListener.onParentItemClickListener(getLayoutPosition()); } }
Source:
<code>public IndexIngestionSpec( @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("ioConfig") IndexIOConfig ioConfig, @JsonProperty("tuningConfig") IndexTuningConfig tuningConfig ) { super(dataSchema, ioConfig, tuningConfig); this.dataSchema = dataSchema; this.ioConfig = ioConfig; this.tuningConfig = tuningConfig == null ? new IndexTuningConfig() : tuningConfig; <START> if (this.ioConfig.isAppendToExisting() && this.tuningConfig.isForceGuaranteedRollup()) { <END> log.warn("Perfect rollup is not guaranteed when appending to existing data sources." + " forceGuaranteedRollup flag is ignored."); } }</code><technical_language>Avoid warnings construction, constructors get called deserialization in contexts. Also, is this useful, is another check is task itself</technical_language>

Target:
public IndexIngestionSpec( @JsonProperty("dataSchema") DataSchema dataSchema, @JsonProperty("ioConfig") IndexIOConfig ioConfig, @JsonProperty("tuningConfig") IndexTuningConfig tuningConfig ) { super(dataSchema, ioConfig, tuningConfig); this.dataSchema = dataSchema; this.ioConfig = ioConfig; this.tuningConfig = tuningConfig == null ? new IndexTuningConfig() : tuningConfig; }
Source:
<code>public static <T> T toObject(String json, TypeReference<T> type) throws IOException { try { return mapper.readValue(json, type); } catch (JsonParseException e) { <START> throw new RuntimeException("Could not parse " + json, e); <END> } }</code><technical_language>Please change RuntimeException IOException most. consider improving exception message: throw new IOException(String.format("Failed parse json '%s'", json), e);</technical_language>

Target:
public static <T> T toObject(String json, TypeReference<T> type) throws IOException { try { return mapper.readValue(json, type); } catch (JsonParseException e) { throw new IOException(String.format("Failed to parse json '%s'", json), e); } }
Source:
<code>private void binaryProperties(NodeState state, String path, BufferedWriter writer, AtomicInteger count) { for (PropertyState p : state.getProperties()) { String propPath = PathUtils.concat(path, p.getName()); try { String id ; if (p.getType() == Type.BINARY) { id = p.getValue(Type.BINARY).getContentIdentity(); <START> if (id == null || id.startsWith(INLINE_BINARY_SUFFIX)) continue; <END> writeAsLine(writer, getLine(id, propPath), false); count.incrementAndGet(); } else if (p.getType() == Type.BINARIES && p.count() > 0) { Iterator<Blob> iterator = p.getValue(Type.BINARIES).iterator(); while (iterator.hasNext()) { id = iterator.next().getContentIdentity(); if (id == null || id.startsWith(INLINE_BINARY_SUFFIX)) { continue; } writeAsLine(writer, getLine(id, propPath), false); count.incrementAndGet(); } } } catch (Exception e) { System.err.println("Error in retrieving blob id for path " + propPath); } } }</code><technical_language>I this is a Blob... isInlined() instead of startsWith? way, INLINE_BINARY_SUFFIX is needed</technical_language>

Target:
private void binaryProperties(NodeState state, String path, BufferedWriter writer, AtomicInteger count) { for (PropertyState p : state.getProperties()) { String propPath = PathUtils.concat(path, p.getName()); try { String id ; if (p.getType() == Type.BINARY) { id = p.getValue(Type.BINARY).getContentIdentity(); if (id == null || p.getValue(Type.BINARY).isInlined()) { continue; } writeAsLine(writer, getLine(id, propPath), false); count.incrementAndGet(); } else if (p.getType() == Type.BINARIES && p.count() > 0) { Iterator<Blob> iterator = p.getValue(Type.BINARIES).iterator(); while (iterator.hasNext()) { id = iterator.next().getContentIdentity(); if (id == null || p.getValue(Type.BINARY).isInlined()) { continue; } writeAsLine(writer, getLine(id, propPath), false); count.incrementAndGet(); } } } catch (Exception e) { System.err.println("Error in retrieving blob id for path " + propPath); } } }
Source:
<code>protected void addCorrelationParameterValueExpression(AbstractExpression expr, List<AbstractExpression> pves) { <START> int paramIdx = AbstractParsedStmt.NEXT_PARAMETER_ID.getAndIncrement(); <END> m_parameterIdxList.add(paramIdx); ParameterValueExpression pve = new ParameterValueExpression(paramIdx, expr); pves.add(pve); }</code><technical_language>Hmm... parameter IDs adjacent for statement, right? If concurrent planners case havoc result. I NEXT_PARAMETER_ID a normal (non-static) member of some object is shared more thread. QueryPlanner fit this description</technical_language>

Target:
protected void addCorrelationParameterValueExpression(AbstractExpression expr, List<AbstractExpression> pves) { int paramIdx = AbstractParsedStmt.NEXT_PARAMETER_ID++; m_parameterIdxList.add(paramIdx); ParameterValueExpression pve = new ParameterValueExpression(paramIdx, expr); pves.add(pve); }
Source:
<code>public ThriftClientHandler(TabletServer server) { super(server.getContext(), server.getWatcher(), server.getFileSystem()); this.server = server; this.watcher = server.getWatcher(); <START> this.fs = server.getFileSystem(); <END> this.security = server.getSecurity(); this.sessionManager = server.getSessionManager(); this.updateMetrics = server.getUpdateMetrics(); this.scanMetrics = server.getScanMetrics(); this.logger = server.getLogger(); log.debug("{} created", ThriftClientHandler.class.getName()); }</code><technical_language>need get "file system" tserver. get ServerContext: suggestion this.fs = server.getContext().getVolumeManager();</technical_language>

Target:
ThriftClientHandler(TabletServer server) { super(server.getContext(), new TransactionWatcher(server.getContext()), server.getFileSystem()); this.server = server; log.debug("{} created", ThriftClientHandler.class.getName()); }
Source:
<code>static boolean equals(byte[] bytes1, int startPos1, byte[] bytes2, int startPos2, int length) { int remainingBytes = length & 7; final long baseOffset1 = BYTE_ARRAY_BASE_OFFSET + startPos1; final long diff = startPos2 - startPos1; if (length > 7) { final long end = baseOffset1 + remainingBytes; <START> for (long i = baseOffset1 - 8 + length; i >= end; i -= 8) { <END> if (UNSAFE.getLong(bytes1, i) != UNSAFE.getLong(bytes2, i + diff)) { return false; } } } if (remainingBytes >= 4) { remainingBytes -= 4; long pos = baseOffset1 + remainingBytes; if (UNSAFE.getInt(bytes1, pos) != UNSAFE.getInt(bytes2, pos + diff)) { return false; } } long baseOffset2 = baseOffset1 + diff; if (remainingBytes >= 2) { return UNSAFE.getChar(bytes1, baseOffset1) == UNSAFE.getChar(bytes2, baseOffset2) && (remainingBytes == 2 || UNSAFE.getByte(bytes1, baseOffset1 + 2) == UNSAFE.getByte(bytes2, baseOffset2 + 2)); } return remainingBytes == 0 || UNSAFE.getByte(bytes1, baseOffset1) == UNSAFE.getByte(bytes2, baseOffset2); }</code><technical_language>@normanmaurer IIRC Java aligns objects word boundaries, imply arrays start word boundaries. this imply iterating a odd number offset result in torn reads? Im surprised this starting beginning</technical_language>

Target:
static boolean equals(byte[] bytes1, int startPos1, byte[] bytes2, int startPos2, int length) { int remainingBytes = length & 7; final long baseOffset1 = BYTE_ARRAY_BASE_OFFSET + startPos1; final long diff = startPos2 - startPos1; if (length >= 8) { final long end = baseOffset1 + remainingBytes; for (long i = baseOffset1 - 8 + length; i >= end; i -= 8) { if (UNSAFE.getLong(bytes1, i) != UNSAFE.getLong(bytes2, i + diff)) { return false; } } } if (remainingBytes >= 4) { remainingBytes -= 4; long pos = baseOffset1 + remainingBytes; if (UNSAFE.getInt(bytes1, pos) != UNSAFE.getInt(bytes2, pos + diff)) { return false; } } final long baseOffset2 = baseOffset1 + diff; if (remainingBytes >= 2) { return UNSAFE.getChar(bytes1, baseOffset1) == UNSAFE.getChar(bytes2, baseOffset2) && (remainingBytes == 2 || UNSAFE.getByte(bytes1, baseOffset1 + 2) == UNSAFE.getByte(bytes2, baseOffset2 + 2)); } return remainingBytes == 0 || UNSAFE.getByte(bytes1, baseOffset1) == UNSAFE.getByte(bytes2, baseOffset2); }
Source:
<code><START> private List<Pair<Germplasm, Name>> getPairs(final CrossSetting crossSetting, final ImportedCrossesList importedCrossesList, <END> final Integer userId, final Workbook workbook) { for (final ImportedCrosses importedCross : importedCrossesList.getImportedCrosses()) { if (importedCross.getSource() == null || StringUtils.isEmpty(importedCross.getSource()) || importedCross.getSource().equalsIgnoreCase(ImportedCrosses.NO_SEED_SOURCE)) { final GermplasmOriginGenerationParameters parameters = this.germplasmOriginParameterBuilder.build(workbook, importedCross); final String generatedSource = this.germplasmOriginGenerationService.generateOriginString(parameters); importedCross.setSource(generatedSource); } } final List<Pair<Germplasm, Name>> germplasmPairs = this.generateGermplasmNamePairs(crossSetting, importedCrossesList.getImportedCrosses(), userId, importedCrossesList.hasPlotDuplicate()); final List<Germplasm> germplasmList = this.extractGermplasmList(germplasmPairs); final Integer crossingNameTypeId = this.getIDForUserDefinedFieldCrossingName(); CrossingUtil.applyBreedingMethodSetting(this.germplasmDataManager, crossSetting, germplasmList); CrossingUtil.applyMethodNameType(this.germplasmDataManager, germplasmPairs, crossingNameTypeId); final boolean isValid = this.verifyGermplasmMethodPresent(germplasmList); if (!isValid) { throw new MiddlewareQueryException(this.messageSource.getMessage("error.save.cross.methods.unavailable", new Object[] {}, Locale.getDefault())); } return germplasmPairs; }</code><technical_language>Please rename method capture function - generateGermplasmNamePairs</technical_language>

Target:
private List<Pair<Germplasm, Name>> getPairs(final CrossSetting crossSetting, final ImportedCrossesList importedCrossesList, final Integer userId, final Workbook workbook) { for (final ImportedCrosses importedCross : importedCrossesList.getImportedCrosses()) { if (importedCross.getSource() == null || StringUtils.isEmpty(importedCross.getSource()) || importedCross.getSource().equalsIgnoreCase(ImportedCrosses.NO_SEED_SOURCE)) { final GermplasmOriginGenerationParameters parameters = this.germplasmOriginParameterBuilder.build(workbook, importedCross); final String generatedSource = this.germplasmOriginGenerationService.generateOriginString(parameters); importedCross.setSource(generatedSource); } } final List<Pair<Germplasm, Name>> germplasmNamePairs = this.generateGermplasmNamePairs(crossSetting, importedCrossesList.getImportedCrosses(), userId, importedCrossesList.hasPlotDuplicate()); final List<Germplasm> germplasmList = this.extractGermplasmList(germplasmNamePairs); final Integer crossingNameTypeId = this.getIDForUserDefinedFieldCrossingName(); CrossingUtil.applyBreedingMethodSetting(this.germplasmDataManager, crossSetting, germplasmList); CrossingUtil.applyMethodNameType(this.germplasmDataManager, germplasmNamePairs, crossingNameTypeId); this.verifyGermplasmMethodPresent(germplasmList); return germplasmNamePairs; }
Source:
<code>public static String getIdentifiableComponentName(Component component) throws IllegalStateException { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: String reference = component.getReference(); <START> if (reference != null) { <END> return reference; } else { return component.getType(); } default: throw new IllegalStateException( format("Unhandled component type: %s", component.getType())); } }</code><technical_language>Oh. return reference != null ? reference : component.getType()</technical_language>

Target:
public static String getIdentifiableComponentName(Component component) throws IllegalStateException { if (component.getAlias() != null) { return component.getAlias(); } switch (component.getType()) { case EDITOR_COMPONENT_TYPE: case PLUGIN_COMPONENT_TYPE: return component.getId(); case DOCKERIMAGE_COMPONENT_TYPE: return component.getImage(); case KUBERNETES_COMPONENT_TYPE: case OPENSHIFT_COMPONENT_TYPE: String reference = component.getReference(); return reference == null ? component.getType() : reference; default: throw new IllegalStateException( format("Unhandled component type: %s", component.getType())); } }
Source:
<code>public <C> C unwrap(Class<C> type) { <START> if ( type.isAssignableFrom( HibernateConstraintViolation.class ) ) { <END> return type.cast( this ); } throw log.getTypeNotSupportedForUnwrappingException( type ); }</code><technical_language>I guess instead of removing original if statement, able add type.isAssignableFrom( HibernateConstraintViolation.class ) a if statement, right</technical_language>

Target:
public <C> C unwrap(Class<C> type) { if ( type.isAssignableFrom( ConstraintViolation.class ) ) { return type.cast( this ); } if ( type.isAssignableFrom( HibernateConstraintViolation.class ) ) { return type.cast( this ); } throw log.getTypeNotSupportedForUnwrappingException( type ); }
Source:
<code>public CliCommand init(final Arguments args) throws Exception { this.userId = args.getId(); <START> if (this.userId == null) { <END> throw new MissingOptionException("The get_user command requires '-i' to be set with the username or Id"); } return this; }</code><technical_language>a guard method</technical_language>

Target:
public CliCommand init(final Arguments args) throws Exception { this.userId = args.getId(); if (Guard.isStringNullOrEmpty(this.userId)) { throw new MissingOptionException("The get_user command requires '-i' to be set with the username or Id"); } return this; }
Source:
<code>public void clean() throws GitException, InterruptedException { reset(true); String cmd = "-fdx"; launchCommand("clean", cmd); <START> } <END></code><technical_language>I want clarify a Java programmer, I sense a common practice in Java, set a default parameter public void clean(boolean cleanSubmodule = false)</technical_language>

Target:
public void clean() throws GitException, InterruptedException { this.clean(false); }