auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void makeInnerQualifyingSet() { if (presentStream == null) { numInnerRows = inputQualifyingSet.getPositionCount(); hasNulls = false; return; } hasNulls = true; if (innerQualifyingSet == null) { innerQualifyingSet = new QualifyingSet(); } int[] inputRows = inputQualifyingSet.getPositions(); int numActive = inputQualifyingSet.getPositionCount(); innerQualifyingSet.reset(numActive); int prevRow = 0; int prevInner = innerPosInRowGroup; numNullsToAdd = 0; boolean keepNulls = filter == null || filter.testNull(); for (int activeIdx = 0; activeIdx < numActive; activeIdx++) { int row = inputRows[activeIdx] - posInRowGroup; if (!present[row]) { if (keepNulls) { addNullToKeep(inputRows[activeIdx], activeIdx); } } else { prevInner += countPresent(prevRow, row); prevRow = row; innerQualifyingSet.append(prevInner, activeIdx); } } numInnerRows = innerQualifyingSet.getPositionCount(); int skip = countPresent(prevRow, inputQualifyingSet.getEnd() - posInRowGroup); innerQualifyingSet.setEnd(skip + prevInner); }

Target:
protected void makeInnerQualifyingSet() { if (presentStream == null) { numInnerRows = inputQualifyingSet.getPositionCount(); hasNulls = false; return; } hasNulls = true; boolean nonDeterministic = filter != null && !deterministicFilter; if (innerQualifyingSet == null) { innerQualifyingSet = new QualifyingSet(); } int[] inputRows = inputQualifyingSet.getPositions(); int numActive = inputQualifyingSet.getPositionCount(); innerQualifyingSet.reset(numActive); int prevRow = 0; int prevInner = innerPosInRowGroup; numNullsToAdd = 0; boolean keepNulls = filter == null || (!nonDeterministic && filter.testNull()); for (int activeIdx = 0; activeIdx < numActive; activeIdx++) { int row = inputRows[activeIdx] - posInRowGroup; if (!present[row]) { if (keepNulls || (nonDeterministic && testNullAt(row + posInRowGroup))) { addNullToKeep(inputRows[activeIdx], activeIdx); } } else { prevInner += countPresent(prevRow, row); prevRow = row; innerQualifyingSet.append(prevInner, activeIdx); } } numInnerRows = innerQualifyingSet.getPositionCount(); int skip = countPresent(prevRow, inputQualifyingSet.getEnd() - posInRowGroup); innerQualifyingSet.setEnd(skip + prevInner); }
Source:
public void testHttpIngestionInvalidFutureCollectionTime() throws Exception { String prefix = getPrefix(); long time = System.currentTimeMillis() + 600000 + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); HttpResponse response = postGenMetric( TID, prefix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertEquals( 4, output.length ); assertTrue( Pattern.matches( JSONMetricsContainerTest.FUTURE_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.FUTURE_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( JSONMetricsContainerTest.FUTURE_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }

Target:
public void testHttpIngestionInvalidFutureCollectionTime() throws Exception { String postfix = getPostfix(); long time = System.currentTimeMillis() + TIME_DIFF_MS + Configuration.getInstance().getLongProperty( CoreConfig.AFTER_CURRENT_COLLECTIONTIME_MS ); HttpResponse response = postGenMetric( TID, postfix, postPath, time ); assertEquals( 400, response.getStatusLine().getStatusCode() ); String[] output = getBodyArray( response ); assertEquals( 4, output.length ); assertTrue( Pattern.matches( FUTURE_COLLECTION_TIME_REGEX, output[ 1 ] ) ); assertTrue( Pattern.matches( FUTURE_COLLECTION_TIME_REGEX, output[ 2 ] ) ); assertTrue( Pattern.matches( FUTURE_COLLECTION_TIME_REGEX, output[ 3 ] ) ); }
Source:
public GoogleCloudStorageItemInfo composeObjects( List<StorageResourceId> sources, final StorageResourceId destination, CreateObjectOptions options) throws IOException { Preconditions.checkArgument(sources.size() <= 32, "Cannot compose more than 32 sources"); ByteArrayOutputStream tempOutput = new ByteArrayOutputStream(); for (StorageResourceId sourceId : sources) { try (SeekableByteChannel sourceChannel = open(sourceId)) { byte[] bufferArray = new byte[4 * 1024 * 1024]; int bytesRead; do { ByteBuffer buffer = ByteBuffer.wrap(bufferArray); bytesRead = sourceChannel.read(buffer); tempOutput.write(bufferArray, 0, buffer.position()); } while (bytesRead >= 0); } } WritableByteChannel destChannel = create(destination, options); destChannel.write(ByteBuffer.wrap(tempOutput.toByteArray())); destChannel.close(); return getItemInfo(destination); }

Target:
public GoogleCloudStorageItemInfo composeObjects( List<StorageResourceId> sources, final StorageResourceId destination, CreateObjectOptions options) throws IOException { checkArgument( sources.size() <= MAX_COMPOSE_OBJECTS, "Can not compose more than %s sources", MAX_COMPOSE_OBJECTS); ByteArrayOutputStream tempOutput = new ByteArrayOutputStream(); for (StorageResourceId sourceId : sources) { try (SeekableByteChannel sourceChannel = open(sourceId)) { byte[] bufferArray = new byte[4 * 1024 * 1024]; int bytesRead; do { ByteBuffer buffer = ByteBuffer.wrap(bufferArray); bytesRead = sourceChannel.read(buffer); tempOutput.write(bufferArray, 0, buffer.position()); } while (bytesRead >= 0); } } WritableByteChannel destChannel = create(destination, options); destChannel.write(ByteBuffer.wrap(tempOutput.toByteArray())); destChannel.close(); return getItemInfo(destination); }
Source:
private void checkSkipBuild() { synchronized (this) { String skipBuildPhrase = helper.checkSkipBuildPhrase(this.pr); if (!StringUtils.isEmpty(skipBuildPhrase)) { logger.log(Level.INFO, "Pull request commented with {0} skipBuildPhrase. Hence skipping the build.", skipBuildPhrase); shouldRun = false; return; } if (commitAuthor == null){ return; } String blackListCommitAuthor = helper.checkBlackListCommitAuthor(commitAuthor.getName()); if (!StringUtils.isEmpty(blackListCommitAuthor)) { logger.log(Level.INFO, "Pull request triggered by {0} user. Hence skipping the build.", blackListCommitAuthor); shouldRun = false; } } }

Target:
private void checkSkipBuild() { synchronized (this) { String skipBuildPhrase = helper.checkSkipBuildPhrase(this.pr); if (!StringUtils.isEmpty(skipBuildPhrase)) { logger.log(Level.INFO, "Pull request commented with {0} skipBuildPhrase. Hence skipping the build.", skipBuildPhrase); shouldRun = false; return; } if (commitAuthor == null){ return; } String blackListCommitAuthor = helper.checkBlackListCommitAuthor(commitAuthor.getName()); if (!StringUtils.isEmpty(blackListCommitAuthor)) { logger.log(Level.FINE, "Pull request triggered by user: {0}. Skipping build because that user is blacklisted.", blackListCommitAuthor); shouldRun = false; } } }
Source:
public void setLoggerLevel(LoggerRequest loggerRequest) throws BadRequestException { try { Class.forName(loggerRequest.getName()); } catch (Throwable ignore) { throw new BadRequestException("The name of the logger is incorrect class name"); } org.apache.log4j.Logger logger = LogManager.getLogger(loggerRequest.getName()); if (null == logger) { throw new BadRequestException("The name of the logger is wrong"); } org.apache.log4j.Level level = org.apache.log4j.Level.toLevel(loggerRequest.getLevel(), null); if (null == level) { throw new BadRequestException("The level of the logger is wrong"); } logger.setLevel(level); }

Target:
public void setLoggerLevel(LoggerRequest loggerRequest) throws BadRequestException { try { Class.forName(loggerRequest.getName()); } catch (Throwable ignore) { throw new BadRequestException( "The class of '" + loggerRequest.getName() + "' doesn't exists"); } org.apache.log4j.Logger logger = LogManager.getLogger(loggerRequest.getName()); if (null == logger) { throw new BadRequestException("The name of the logger is wrong"); } org.apache.log4j.Level level = org.apache.log4j.Level.toLevel(loggerRequest.getLevel(), null); if (null == level) { throw new BadRequestException("The level of the logger is wrong"); } logger.setLevel(level); }
Source:
private IncrementalMetadata getIncrementalMetadata() { if (!"true".equals(processingEnv.getOptions().get(OPTION_INCREMENTAL))) { return null; } Map<String, String> options = processingEnv.getOptions(); String customAnnotationOption = options.get(OPTION_CUSTOM_ANNOTATIONS); if (customAnnotationOption == null) { return new IncrementalMetadata(new String[0]); } return new IncrementalMetadata(customAnnotationOption.split(",")); }

Target:
private IncrementalMetadata getIncrementalMetadata() { if (!"true".equalsIgnoreCase(processingEnv.getOptions().get(OPTION_INCREMENTAL))) { return null; } Map<String, String> options = processingEnv.getOptions(); String customAnnotationOption = options.get(OPTION_CUSTOM_ANNOTATIONS); if (customAnnotationOption == null) { return new IncrementalMetadata(new String[0]); } return new IncrementalMetadata(customAnnotationOption.split(",")); }
Source:
private static void logMismatch(String fieldName, String tableName, Object clientSideVersion, Object clusterSideVersion) { log.info("Found client/server disagreement on for table {}. (client = ({}), server = ({}))", SafeArg.of("disagreementType", fieldName), UnsafeArg.of("table", tableName), SafeArg.of("clientVersion", clientSideVersion), SafeArg.of("clusterVersion", clusterSideVersion)); }

Target:
private static void logMismatch(String fieldName, String tableName, Object clientSideVersion, Object clusterSideVersion) { log.info("Found client/server disagreement on for table {}. (client = ({}), server = ({}))", SafeArg.of("disagreementType", fieldName), LoggingArgs.tableRef(TableReference.createUnsafe(tableName)), SafeArg.of("clientVersion", clientSideVersion), SafeArg.of("clusterVersion", clusterSideVersion)); }
Source:
private static JSONArray getListForURLAction(String urlAction, String paramsString, String resultKey, String sessionID, int pageSize, String methodName) throws IOException, JSONException { int page = 0; JSONArray resultList = new JSONArray(); boolean done = false; while (!done) { String params = "?page=" + page + paramsString; String url = makeUrlFor(urlAction,params); Map<String, String> response = request(url, null, sessionID, HTTP_METHOD_GET); int codeResult = checkResponseCode(response.get(RESPONSE_CODE), methodName); if (codeResult != 0) { throw new IOException("Incorrect response of " + methodName + " from CommonSense,\n the content is:" + response.get(RESPONSE_CONTENT)); } JSONObject content = new JSONObject(response.get(RESPONSE_CONTENT)); JSONArray paramList = content.getJSONArray(resultKey); for (int i = 0; i < paramList.length(); i++) { resultList.put(paramList.getJSONObject(i)); } if (paramList.length() < pageSize) { done = true; } else { page++; } } return resultList; }

Target:
private static JSONArray getListForURLAction(String urlAction, String paramsString, String resultKey, String sessionID, int pageSize, String methodName) throws IOException, JSONException { int page = 0; JSONArray resultList = new JSONArray(); boolean done = false; while (!done) { String params = "?page=" + page + paramsString; String url = makeUrlFor(urlAction,params); Map<String, String> response = request(url, null, sessionID, HTTP_METHOD_GET); int codeResult = checkResponseCode(response.get(RESPONSE_CODE), methodName); if (codeResult != 0) { throw new IOException("Incorrect response of " + methodName + " from CommonSense,\n the code is:" + response.get(RESPONSE_CODE)); } JSONObject content = new JSONObject(response.get(RESPONSE_CONTENT)); JSONArray paramList = content.getJSONArray(resultKey); for (int i = 0; i < paramList.length(); i++) { resultList.put(paramList.getJSONObject(i)); } if (paramList.length() < pageSize) { done = true; } else { page++; } } return resultList; }
Source:
public GenericJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType, EventBus eventBus, LockFactory lockFactory, Function<String, ?> identifierConverter) { this(entityManagerProvider, aggregateType, eventBus, null, null, lockFactory, identifierConverter); }

Target:
public GenericJpaRepository(EntityManagerProvider entityManagerProvider, Class<T> aggregateType, EventBus eventBus, LockFactory lockFactory, Function<String, ?> identifierConverter) { this(entityManagerProvider, aggregateType, eventBus, null, lockFactory, identifierConverter); }
Source:
public void testStatelessExpressionIndex() throws Exception { String ddl = "CREATE TABLE t (k1 INTEGER PRIMARY KEY)"; Connection conn = DriverManager.getConnection(getUrl()); Statement stmt = null; try { stmt = conn.createStatement(); stmt.execute(ddl); stmt.execute("CREATE INDEX i ON t (SUM())"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.STATELESS_EXPRESSION_NOT_ALLOWED_IN_INDEX.getErrorCode(), e.getErrorCode()); } finally { stmt.close(); } }

Target:
public void testStatelessExpressionIndex() throws Exception { String ddl = "CREATE TABLE t (k1 INTEGER PRIMARY KEY)"; Connection conn = DriverManager.getConnection(getUrl()); Statement stmt = null; try { stmt = conn.createStatement(); stmt.execute(ddl); stmt.execute("CREATE INDEX i ON t (2)"); fail(); } catch (SQLException e) { assertEquals(SQLExceptionCode.STATELESS_EXPRESSION_NOT_ALLOWED_IN_INDEX.getErrorCode(), e.getErrorCode()); } finally { stmt.close(); } }
Source:
private void subscribeToData() { this.data .onBackpressureBuffer(Constants.GB) .subscribe( byteBuffer -> { lock.lock(); try { this.buffer = new ByteArrayInputStream(FluxUtil.byteBufferToArray(byteBuffer)); this.waitingForData = false; dataAvailable.signal(); } finally { lock.unlock(); } }, throwable -> { signalOnCompleteOrError(); if (throwable instanceof HttpResponseException) { this.lastError = new IOException(throwable); } else if (throwable instanceof IllegalArgumentException) { this.lastError = new IOException(throwable); } else if (throwable instanceof IOException) { this.lastError = new IOException(throwable); } }, this::signalOnCompleteOrError, subscription -> { this.subscription = subscription; this.subscribed = true; this.subscription.request(1); } ); }

Target:
private void subscribeToData() { this.data .onBackpressureBuffer() .subscribe( byteBuffer -> { this.buffer = new ByteArrayInputStream(FluxUtil.byteBufferToArray(byteBuffer)); lock.lock(); try { this.waitingForData = false; dataAvailable.signal(); } finally { lock.unlock(); } }, throwable -> { if (throwable instanceof IOException) { this.lastError = (IOException) throwable; } else { this.lastError = new IOException(throwable); } signalOnCompleteOrError(); }, this::signalOnCompleteOrError, subscription -> { this.subscription = subscription; this.subscribed = true; this.subscription.request(1); } ); }
Source:
private static String getSuggestedType(boolean springInjectionAnnotated, Type leastSpecificType) { if (springInjectionAnnotated && leastSpecificType.is("java.lang.Iterable")) { return "java.util.Collection"; } else { return leastSpecificType.fullyQualifiedName().replace('$', '.'); } }

Target:
private static String getSuggestedType(boolean springInjectionAnnotated, Type leastSpecificType) { if (springInjectionAnnotated && leastSpecificType.is("java.lang.Iterable")) { return "java.util.Collection"; } return leastSpecificType.fullyQualifiedName().replace('$', '.'); }
Source:
public Response connectKieServer(@Context HttpHeaders headers, @PathParam("serverInstanceId") String id, String serverInfoPayload) { String contentType = getContentType(headers); logger.debug("Received connect request from server with id {}", id); KieServerInfo serverInfo = unmarshal(serverInfoPayload, contentType, KieServerInfo.class); if (serverInfo == null) { serverInfo = new KieServerInfo(); serverInfo.setServerId(id); } logger.debug("Server info {}", serverInfo); KieServerSetup serverSetup = connect(serverInfo); if (serverSetup.hasNoErrors()) { logger.info("Server with id '{}' connected", id); } else { logger.info("Server with id '{}' failed to connect", id); } String response = marshal(contentType, serverSetup); logger.debug("Returning response for connect of server '{}': {}", id, response); return createCorrectVariant(response, headers, serverSetup.hasNoErrors() ? Response.Status.CREATED : Response.Status.BAD_REQUEST); }

Target:
public Response connectKieServer(@Context HttpHeaders headers, @PathParam("serverInstanceId") String id, String serverInfoPayload) { String contentType = getContentType(headers); logger.debug("Received connect request from server with id {}", id); KieServerInfo serverInfo = unmarshal(serverInfoPayload, contentType, KieServerInfo.class); if (serverInfo == null) { serverInfo = new KieServerInfo(); serverInfo.setServerId(id); } logger.debug("Server info {}", serverInfo); KieServerSetup serverSetup = connect(serverInfo); if (serverSetup.hasNoErrors()) { logger.info("Server with id '{}' connected", id); } else { logger.warn("Server with id '{}' failed to connect", id); } String response = marshal(contentType, serverSetup); logger.debug("Returning response for connect of server '{}': {}", id, response); return createCorrectVariant(response, headers, serverSetup.hasNoErrors() ? Response.Status.CREATED : Response.Status.BAD_REQUEST); }
Source:
public CompletionStage<ResultT> start() { LOG.debug("[{}] Executing {}", logPrefix, this); if (preAcquireId && !channel.preAcquireId()) { setFinalError( new BusyConnectionException( String.format( "%s has reached its maximum number of simultaneous requests", channel))); } else { channel.write(message, false, customPayload, this).addListener(this::onWriteComplete); } return result; }

Target:
public CompletionStage<ResultT> start() { LOG.debug("[{}] Executing {}", logPrefix, this); if (shouldPreAcquireId && !channel.preAcquireId()) { setFinalError( new BusyConnectionException( String.format( "%s has reached its maximum number of simultaneous requests", channel))); } else { channel.write(message, false, customPayload, this).addListener(this::onWriteComplete); } return result; }
Source:
public void rebindPartialActive(CompoundTransformer transformer, Iterator<BrooklynObject> objectsToRebind) { final ClassLoader classLoader = managementContext.getCatalog().getRootClassLoader(); final RebindExceptionHandler exceptionHandler = RebindExceptionHandlerImpl.builder() .danglingRefFailureMode(danglingRefFailureMode) .danglingRefQuorumRequiredHealthy(danglingRefsQuorumRequiredHealthy) .rebindFailureMode(rebindFailureMode) .addPolicyFailureMode(addPolicyFailureMode) .loadPolicyFailureMode(loadPolicyFailureMode) .build(); final ManagementNodeState mode = getRebindMode(); ActivePartialRebindIteration iteration = new ActivePartialRebindIteration(this, mode, classLoader, exceptionHandler, rebindActive, readOnlyRebindCount, rebindMetrics, persistenceStoreAccess); iteration.setObjectIterator(objectsToRebind); iteration.applyTransformer(transformer); iteration.run(); }

Target:
public void rebindPartialActive(CompoundTransformer transformer, Iterator<BrooklynObject> objectsToRebind) { final ClassLoader classLoader = managementContext.getCatalog().getRootClassLoader(); final RebindExceptionHandler exceptionHandler = RebindExceptionHandlerImpl.builder() .danglingRefFailureMode(danglingRefFailureMode) .danglingRefQuorumRequiredHealthy(danglingRefsQuorumRequiredHealthy) .rebindFailureMode(rebindFailureMode) .addPolicyFailureMode(addPolicyFailureMode) .loadPolicyFailureMode(loadPolicyFailureMode) .build(); final ManagementNodeState mode = getRebindMode(); ActivePartialRebindIteration iteration = new ActivePartialRebindIteration(this, mode, classLoader, exceptionHandler, rebindActive, readOnlyRebindCount, rebindMetrics, persistenceStoreAccess); iteration.setObjectIterator(Iterators.transform(objectsToRebind, new Function<BrooklynObject,BrooklynObject>() { @Override public BrooklynObject apply(BrooklynObject obj) { if (obj instanceof Entity) obj = Entities.deproxy((Entity)obj); return obj; } })); if (transformer!=null) iteration.applyTransformer(transformer); iteration.run(); }
Source:
public int getItemViewType(int position) { String contentType = sections.get(position).getContentType(); switch (contentType) { case "post": return POST_CAROUSEL; case "chapter_content": return CONTENT_CAROUSEL; case "banner_ad": return OFFERS_CAROUSEL; case "chapter_content_attempt": return CONTENT_CAROUSEL; case "products": return COURSE_CAROUSEL; case "trophy_leaderboard": if (instituteSettings.getLeaderboardEnabled()) return LEADERBOARD_LIST; } return -1; }

Target:
public int getItemViewType(int position) { String contentType = sections.get(position).getContentType(); switch (contentType) { case "post": return POST_CAROUSEL; case "chapter_content": return CONTENT_CAROUSEL; case "banner_ad": return OFFERS_CAROUSEL; case "chapter_content_attempt": return CONTENT_CAROUSEL; case "products": return COURSE_CAROUSEL; case "trophy_leaderboard": if (isLeaderBoardEnabled()) return LEADERBOARD_LIST; } return -1; }
Source:
public void put(List<Put> puts) throws IOException { batchExecutor.batch(puts); }

Target:
public void put(List<Put> puts) throws IOException { batchExecutor.put(puts); }
Source:
public HpccRemoteFileReader(DataPartition dp, FieldDef originalRD, IRecordBuilder recBuilder) throws Exception { this(dp,originalRD,recBuilder,-1); }

Target:
public HpccRemoteFileReader(DataPartition dp, FieldDef originalRD, IRecordBuilder recBuilder) throws Exception { this(dp,originalRD,recBuilder,DEFAULT_CONNECT_TIMEOUT_OPTION); }
Source:
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { switch (jdbcInfo.getDbms()) { case MyriaConstants.STORAGE_SYSTEM_MYSQL: execute("DROP TABLE IF EXISTS " + quote(relationKey)); break; case MyriaConstants.STORAGE_SYSTEM_POSTGRESQL: execute("DROP TABLE IF EXISTS " + quote(relationKey) + " CASCADE"); break; default: throw new UnsupportedOperationException("Don't know whether " + jdbcInfo.getDbms() + " can DROP IF EXISTS a table"); } }

Target:
public void dropTableIfExistsCascade(final RelationKey relationKey) throws DbException { switch (jdbcInfo.getDbms()) { case MyriaConstants.STORAGE_SYSTEM_MYSQL: LOGGER.warn("MySQL does not implement DROP TABLE...CASCADE, attempting DROP TABLE instead"); execute("DROP TABLE IF EXISTS " + quote(relationKey)); break; case MyriaConstants.STORAGE_SYSTEM_POSTGRESQL: execute("DROP TABLE IF EXISTS " + quote(relationKey) + " CASCADE"); break; default: throw new UnsupportedOperationException("Don't know whether " + jdbcInfo.getDbms() + " can DROP IF EXISTS...CASCADE a table"); } }
Source:
public static void setCloudNotificationsEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CLOUD_NOTIFICATIONS, isEnabled); editor.commit(); CloudMessaging.initialize(context); }

Target:
public static void setCloudNotificationsEnabled(Context context, boolean isEnabled) { SharedPreferences.Editor editor = getSharedPreferences(context).edit(); editor.putBoolean(SETTINGS_CLOUD_NOTIFICATIONS, isEnabled).commit(); CloudMessaging.initialize(context); }
Source:
public void showRateLimitError(boolean userTriggered) { if (HiddenPreferences.isRateLimitPopupDisabled() || !userTriggered) { handleFormSendResult(Localization.get("sync.fail.rate.limited.server.error"), false); return; } String title = Localization.get("form.send.rate.limit.error.title"); String message = Localization.get("form.send.rate.limit.error.message"); StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialog(this, title, message, null); dialog.setNegativeButton(Localization.get("dialog.button.do.not.show.again"), (dialog1, which) -> { HiddenPreferences.disableRateLimitPopup(true); dismissAlertDialog(); }); dialog.setPositiveButton(Localization.get("dialog.button.close"), (dialog1, which) -> { dismissAlertDialog(); }); showAlertDialog(dialog); }

Target:
public void showRateLimitError(boolean userTriggered) { if (HiddenPreferences.isRateLimitPopupDisabled() || !userTriggered) { handleFormSendResult(Localization.get("form.send.rate.limit.error.toast"), false); return; } String title = Localization.get("form.send.rate.limit.error.title"); String message = Localization.get("form.send.rate.limit.error.message"); StandardAlertDialog dialog = StandardAlertDialog.getBasicAlertDialog(this, title, message, null); dialog.setNegativeButton(Localization.get("rate.limit.error.dialog.do.not.show"), (dialog1, which) -> { HiddenPreferences.disableRateLimitPopup(true); dismissAlertDialog(); }); dialog.setPositiveButton(Localization.get("rate.limit.error.dialog.close"), (dialog1, which) -> { dismissAlertDialog(); }); showAlertDialog(dialog); }
Source:
private void prepareNoteExtendedAttributes() { if (LOG.isDebugEnabled()) { LOG.debug("prepareNoteExtendedAttributes, number of notes to review: " + getNotes().size()); } for (Note note : getNotes()) { if (note.getNoteIdentifier() == null) { LOG.debug("prepareNoteExtendedAttributes, found a note without an ID, it needs to be set."); Long newNoteId = getSequenceAccessorService().getNextAvailableSequenceNumber(CUKFSConstants.NOTE_SEQUENCE_NAME); note.setNoteIdentifier(newNoteId); } NoteExtendedAttribute extendedAttribute; if (ObjectUtils.isNull(note.getExtension())) { if (LOG.isDebugEnabled()) { LOG.debug("prepareNoteExtendedAttributes, found a note without an extentsion, note ID " + note.getNoteIdentifier()); } extendedAttribute = new NoteExtendedAttribute(); note.setExtension(extendedAttribute); } else { extendedAttribute = (NoteExtendedAttribute) note.getExtension(); } if (ObjectUtils.isNull(extendedAttribute.getNoteIdentifier())) { if (LOG.isDebugEnabled()) { LOG.debug("prepareNoteExtendedAttributes, the note " + note.getNoteIdentifier() + " has an extended attribute without a note identifier."); } extendedAttribute.setNoteIdentifier(note.getNoteIdentifier()); } } }

Target:
private void prepareNoteExtendedAttributes() { if (LOG.isDebugEnabled()) { LOG.debug("prepareNoteExtendedAttributes, number of notes to review: " + getNotes().size()); } for (Note note : getNotes()) { setNoteIdentifierIfEmpty(note); NoteExtendedAttribute extendedAttribute = retrieveOrCreateNoteExtendedAttribute(note); setNoteExtendedAttributeNoteIdentifierIfEmpty(note, extendedAttribute); } }
Source:
private Mono<Lease> renew(CancellationToken cancellationToken) { LeaseRenewerImpl self = this; if (cancellationToken.isCancellationRequested()) return Mono.empty(); return self.leaseManager.renew(self.lease) .map(renewedLease -> { if (renewedLease != null) { self.lease = renewedLease; } logger.info(String.format("Partition %s: renewed lease with result %s", self.lease.getLeaseToken(), renewedLease != null)); return renewedLease; }) .onErrorResume(throwable -> { if (throwable instanceof LeaseLostException) { LeaseLostException lle = (LeaseLostException) throwable; self.resultException = lle; logger.error(String.format("Partition %s: lost lease on renew.", self.lease.getLeaseToken()), lle); return Mono.error(lle); } logger.error(String.format("Partition %s: failed to renew lease.", self.lease.getLeaseToken()), throwable); return Mono.empty(); }); }

Target:
private Mono<Lease> renew(CancellationToken cancellationToken) { if (cancellationToken.isCancellationRequested()) { return Mono.empty(); } return this.leaseManager.renew(this.lease) .map(renewedLease -> { if (renewedLease != null) { this.lease = renewedLease; } logger.info("Partition {}: renewed lease with result {}", this.lease.getLeaseToken(), renewedLease != null); return renewedLease; }) .onErrorResume(throwable -> { if (throwable instanceof LeaseLostException) { LeaseLostException lle = (LeaseLostException) throwable; this.resultException = lle; logger.error("Partition {}: lost lease on renew.", this.lease.getLeaseToken(), lle); return Mono.error(lle); } logger.error("Partition {}: failed to renew lease.", this.lease.getLeaseToken(), throwable); return Mono.empty(); }); }
Source:
public void apply(String endpointId, FileChangedEventDto dto) { Tree tree = projectExplorerPresenterProvider.get().getTree(); tree.getNodeStorage() .getAll() .stream() .filter( node -> node instanceof FileNode && ((ResourceNode) node) .getData() .getLocation() .equals(Path.valueOf(dto.getPath()))) .forEach( node -> { ((ResourceNode) node) .getData() .asFile() .setVcsStatus(VcsStatus.from(dto.getStatus().toString())); tree.refresh(node); }); editorAgentProvider .get() .getOpenedEditors() .stream() .filter( editor -> editor.getEditorInput().getFile().getLocation().equals(Path.valueOf(dto.getPath()))) .forEach( editor -> { VcsStatus vcsStatus = VcsStatus.from(dto.getStatus().toString()); EditorTab tab = multiPartStackProvider.get().getTabByPart(editor); if (vcsStatus != null) { tab.setTitleColor(vcsStatus.getColor()); } VcsChangeMarkerRender render = ((HasVcsChangeMarkerRender) editor).getVcsChangeMarkersRender(); if (((File) editor.getEditorInput().getFile()).getVcsStatus() != MODIFIED) { render.clearAllChangeMarkers(); } else { handleEditedRegions(dto.getEditedRegions(), render); } }); appContext.getWorkspaceRoot().synchronize(); }

Target:
public void apply(String endpointId, FileChangedEventDto dto) { Tree tree = projectExplorerPresenterProvider.get().getTree(); tree.getNodeStorage() .getAll() .stream() .filter( node -> node instanceof FileNode && ((ResourceNode) node) .getData() .getLocation() .equals(Path.valueOf(dto.getPath()))) .forEach( node -> { setVcsStatusToEditorsFile( Path.valueOf(dto.getPath()), VcsStatus.from(dto.getStatus().toString())); ((ResourceNode) node) .getData() .asFile() .setVcsStatus(VcsStatus.from(dto.getStatus().toString())); tree.refresh(node); }); editorAgentProvider .get() .getOpenedEditors() .stream() .filter( editor -> editor.getEditorInput().getFile().getLocation().equals(Path.valueOf(dto.getPath())) && editor instanceof HasVcsChangeMarkerRender) .forEach( editor -> { VcsStatus vcsStatus = VcsStatus.from(dto.getStatus().toString()); EditorTab tab = multiPartStackProvider.get().getTabByPart(editor); if (vcsStatus != null) { tab.setTitleColor(vcsStatus.getColor()); } VcsChangeMarkerRender render = ((HasVcsChangeMarkerRender) editor).getVcsChangeMarkersRender(); if (((File) editor.getEditorInput().getFile()).getVcsStatus() != MODIFIED) { render.clearAllChangeMarkers(); } else { handleEditedRegions(dto.getEditedRegions(), render); } }); }
Source:
CronJobsDefinitionsRegistry(final CronJobsRegistry cronJobsRegistry) { cronJobDefinitions = cronJobsRegistry.get() .stream() .map(ThrowingFunction.unchecked(clazz -> clazz.newInstance() .getCronJobDefinition())) .collect(Collectors.toSet()); }

Target:
CronJobsDefinitionsRegistry(final CronJobsRegistry cronJobsRegistry) { cronJobDefinitions = cronJobsRegistry.get() .stream() .map(ThrowingFunction.unchecked(clazz -> clazz.newInstance() .getCronJobDefinition())) .collect(Collectors.collectingAndThen(Collectors.toSet(), Collections::unmodifiableSet)); }
Source:
private ApiInfo readApiInfo(ServletContext context) { try { try (InputStream inputStream = context.getResourceAsStream("/META-INF/MANIFEST.MF")) { final Manifest manifest = new Manifest(inputStream); final Attributes mainAttributes = manifest.getMainAttributes(); final DtoFactory dtoFactory = DtoFactory.getInstance(); return dtoFactory .createDto(ApiInfo.class) .withSpecificationVendor(mainAttributes.getValue("Specification-Vendor")) .withImplementationVendor(mainAttributes.getValue("Implementation-Vendor")) .withSpecificationTitle("Codenvy REST API") .withSpecificationVersion(mainAttributes.getValue("Specification-Version")) .withImplementationVersion(mainAttributes.getValue("Implementation-Version")) .withScmRevision(mainAttributes.getValue("SCM-Revision")); } } catch (Exception e) { LOG.error("Unable to read API info. Error: " + e.getMessage(), e); throw new RuntimeException("Unable to read API information", e); } }

Target:
private ApiInfo readApiInfo(ServletContext context) { try { try (InputStream inputStream = context.getResourceAsStream("/META-INF/MANIFEST.MF")) { final Manifest manifest = new Manifest(inputStream); final Attributes mainAttributes = manifest.getMainAttributes(); final DtoFactory dtoFactory = DtoFactory.getInstance(); return dtoFactory .createDto(ApiInfo.class) .withSpecificationVendor(mainAttributes.getValue("Specification-Vendor")) .withImplementationVendor(mainAttributes.getValue("Implementation-Vendor")) .withSpecificationTitle("Che REST API") .withSpecificationVersion(mainAttributes.getValue("Specification-Version")) .withImplementationVersion(mainAttributes.getValue("Implementation-Version")) .withScmRevision(mainAttributes.getValue("SCM-Revision")); } } catch (Exception e) { LOG.error("Unable to read API info. Error: " + e.getMessage(), e); throw new RuntimeException("Unable to read API information", e); } }
Source:
public static void writeToBuckFile(Multimap<String, String> loadStatements, List<Rule> rules, File buckFile) { if (!rules.isEmpty()) { File parent = buckFile.getParentFile(); if (!parent.exists() && !parent.mkdirs()) { throw new IllegalStateException("Couldn't create dir: " + parent); } try ( OutputStream fos = new FileOutputStream(buckFile); BufferedOutputStream os = new BufferedOutputStream(fos)){ writeLoadStatements(loadStatements, os); for (int index = 0; index < rules.size(); index++) { if (index != 0) { os.write(NEWLINE); } rules.get(index).render(os); } } catch (IOException e) { throw new IllegalStateException("Couldn't create the buck file", e); } } }

Target:
public static void writeToBuckFile(Multimap<String, String> loadStatements, List<Rule> rules, File buckFile) { if (!rules.isEmpty()) { File parent = buckFile.getParentFile(); if (!parent.exists() && !parent.mkdirs()) { throw new IllegalStateException("Couldn't create dir: " + parent); } try ( OutputStream fos = new FileOutputStream(buckFile); BufferedOutputStream os = new BufferedOutputStream(fos)){ if (!loadStatements.isEmpty()) { LoadStatements.template(writableLoadStatements(loadStatements)).render(os); } for (int index = 0; index < rules.size(); index++) { if (index != 0) { os.write(NEWLINE); } rules.get(index).render(os); } } catch (IOException e) { throw new IllegalStateException("Couldn't create the buck file", e); } } }
Source:
public String getDisplayValue() { CutoffFacetNode lastNode = this.getHighestTierNode(); if (lastNode == null) return null; return lastNode.getSearchKey(); }

Target:
public String getDisplayValue() { return getSearchKey(); }
Source:
public CompletableFuture<List<Map<String, Object>>> get (DataFetchingEnvironment environment) { Map<String, Object> parentEntityMap = environment.getSource(); String namespace = (String) parentEntityMap.get("namespace"); List<String> inClauseValues = new ArrayList<>(); if (parentJoinField != null) { Map<String, Object> enclosingEntity = environment.getSource(); Object inClauseValue = enclosingEntity.get(parentJoinField); String inClauseString = inClauseValue == null ? null : inClauseValue.toString(); inClauseValues.add(inClauseString); if (inClauseValue == null) { return new CompletableFuture<>(); } } Map<String, Object> arguments = environment.getArguments(); StringBuilder sqlBuilder = new StringBuilder(); sqlBuilder.append("select *"); return getResults( getJdbcQueryDataLoaderFromContext(environment), getDataSourceFromContext(environment), namespace, inClauseValues, arguments, new ArrayList<>(), new ArrayList<>(), new HashSet<>(), sqlBuilder ); }

Target:
public CompletableFuture<List<Map<String, Object>>> get (DataFetchingEnvironment environment) { List<String> inClauseValues = new ArrayList<>(); List<String> whereConditions = new ArrayList<>(); List<String> preparedStatementParameters = new ArrayList<>(); if (parentJoinField != null) { Map<String, Object> enclosingEntity = environment.getSource(); Object inClauseValue = enclosingEntity.get(parentJoinField); String inClauseString = inClauseValue == null ? null : inClauseValue.toString(); inClauseValues.add(inClauseString); if (inClauseValue == null) { return new CompletableFuture<>(); } whereConditions.add(makeInClause(parentJoinField, inClauseValues, preparedStatementParameters)); } return getResults( environment, "select *", new HashSet<>(), whereConditions, preparedStatementParameters ); }
Source:
public static PushToApplicationSettings getSettings(PushToApplication application) { if (application instanceof PushToEmacs) { return new PushToEmacsSettings(application.getDialogService()); } else if (application instanceof PushToLyx) { return new PushToLyxSettings(application.getDialogService()); } else if (application instanceof PushToVim) { return new PushToVimSettings(application.getDialogService()); } else { return new PushToApplicationSettings(application.getDialogService()); } }

Target:
public PushToApplicationSettings getSettings(PushToApplication application) { if (application instanceof PushToEmacs) { return new PushToEmacsSettings(dialogService); } else if (application instanceof PushToLyx) { return new PushToLyxSettings(dialogService); } else if (application instanceof PushToVim) { return new PushToVimSettings(dialogService); } else { return new PushToApplicationSettings(dialogService); } }
Source:
protected List<String>[] getTemplates(String[] titles, String template, int... ns) throws IOException { List<String>[] ret = new ArrayList[titles.length]; StringBuilder url = new StringBuilder(query); url.append("prop=templates&tllimit=max"); constructNamespaceString(url, "tl", ns); if (template != null) { url.append("&tltemplates="); url.append(encode(template, false)); } url.append("&titles="); String[] titlestrings = constructTitleString(url.length() + "&tlcontinue=".length(), titles, true); for (String temp : titlestrings) { String tempurl = url.toString() + temp; String tlcontinue = null; do { String line; if (tlcontinue == null) line = fetch(tempurl, "getTemplates"); else line = fetch(tempurl + "&tlcontinue=" + encode(tlcontinue, false), "getTemplates"); tlcontinue = parseAttribute(line, "tlcontinue", 0); String[] x = line.split("<page "); for (int i = 1; i < x.length; i++) { int index = -1; String parsedtitle = parseAttribute(x[i], "title", 0); for (int j = 0; j < titles.length; j++) if (normalize(titles[j]).equals(parsedtitle)) index = j; if (ret[index] == null) ret[index] = new ArrayList<>(750); for (int a = x[i].indexOf("<tl "); a > 0; a = x[i].indexOf("<tl ", ++a)) ret[index].add(parseAttribute(x[i], "title", a)); } } while (tlcontinue != null); } log(Level.INFO, "getTemplates", "Successfully retrieved templates used on " + titles.length + " pages."); return ret; }

Target:
protected List<String>[] getTemplates(String[] titles, String template, int... ns) throws IOException { List<String>[] ret = new ArrayList[titles.length]; StringBuilder url = new StringBuilder(query); url.append("prop=templates&tllimit=max"); constructNamespaceString(url, "tl", ns); if (template != null) { url.append("&tltemplates="); url.append(encode(template, false)); } url.append("&titles="); String[] titlestrings = constructTitleString(url.length() + "&tlcontinue=".length() + 1000, titles, true); for (String temp : titlestrings) { String tempurl = url.toString() + temp; String tlcontinue = null; do { String line; if (tlcontinue == null) line = fetch(tempurl, "getTemplates"); else line = fetch(tempurl + "&tlcontinue=" + encode(tlcontinue, false), "getTemplates"); tlcontinue = parseAttribute(line, "tlcontinue", 0); String[] x = line.split("<page "); for (int i = 1; i < x.length; i++) { int index = -1; String parsedtitle = parseAttribute(x[i], "title", 0); for (int j = 0; j < titles.length; j++) if (normalize(titles[j]).equals(parsedtitle)) index = j; if (ret[index] == null) ret[index] = new ArrayList<>(750); for (int a = x[i].indexOf("<tl "); a > 0; a = x[i].indexOf("<tl ", ++a)) ret[index].add(parseAttribute(x[i], "title", a)); } } while (tlcontinue != null); } log(Level.INFO, "getTemplates", "Successfully retrieved templates used on " + titles.length + " pages."); return ret; }
Source:
private static File getFileFromClassLoader4Luna(String filename, ClassLoader classLoader) throws AssertionFailedError { try { Object classpathManager = MethodUtils.invokeExactMethod(classLoader, "getClasspathManager", null); if (classpathManager != null) { Object generation = MethodUtils.invokeExactMethod(classpathManager, "getGeneration", null); if (generation != null) { Object bundleFile = MethodUtils.invokeExactMethod(generation, "getBundleFile", null); if (bundleFile != null) { File file = (File) MethodUtils.invokeExactMethod(bundleFile, "getFile", new Object[] { filename, true }, new Class[] { String.class, boolean.class }); if (file != null) { return file; } } } } } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } throw new AssertionFailedError("no file found " + filename); }

Target:
private static File getFileFromClassLoader4Luna(String filename, ClassLoader classLoader) throws AssertionFailedError { String AssertionFailedErrorMessage = "no file found " + filename; try { Object classpathManager = MethodUtils.invokeExactMethod(classLoader, "getClasspathManager", null); if (classpathManager != null) { Object generation = MethodUtils.invokeExactMethod(classpathManager, "getGeneration", null); if (generation != null) { Object bundleFile = MethodUtils.invokeExactMethod(generation, "getBundleFile", null); if (bundleFile != null) { File file = (File) MethodUtils.invokeExactMethod(bundleFile, "getFile", new Object[] { filename, true }, new Class[] { String.class, boolean.class }); if (file != null) { return file; } } } } } catch (NoSuchMethodException e) { AssertionFailedErrorMessage = "got NoSuchMethodException " + e.getMessage(); } catch (IllegalAccessException e) { AssertionFailedErrorMessage = "got IllegalAccessException " + e.getMessage(); } catch (InvocationTargetException e) { AssertionFailedErrorMessage = "got InvocationTargetException " + e.getMessage(); } throw new AssertionFailedError(AssertionFailedErrorMessage); }
Source:
public void should_throw_exception_when_frame_exceeds_configured_max() { org.apache.log4j.Logger connectionLogger = org.apache.log4j.Logger.getLogger(Connection.class); Level originalLevel = connectionLogger.getLevel(); connectionLogger.setLevel(Level.DEBUG); MemoryAppender logs = new MemoryAppender(); connectionLogger.addAppender(logs); try { session().execute(select().from(tableName).where(eq("k", 0))); fail("Exception expected"); } catch (NoHostAvailableException e) { assertThat(e.getErrors()).hasSize(2); } finally { assertThat(logs.get()).contains("io.netty.handler.codec.TooLongFrameException"); connectionLogger.setLevel(originalLevel); connectionLogger.removeAppender(logs); } waitForUp(ipOfNode(1), cluster(), 10); waitForUp(ipOfNode(2), cluster(), 10); ResultSet result = session().execute(select().from(tableName).where(eq("k", 0)).and(eq("c", 0))); assertThat(result.getAvailableWithoutFetching()).isEqualTo(1); }

Target:
public void should_throw_exception_when_frame_exceeds_configured_max() { try { session().execute(select().from(tableName).where(eq("k", 0))); fail("Exception expected"); } catch (FrameTooLongException ftle) { } Collection<Host> hosts = session().getState().getConnectedHosts(); assertThat(hosts).hasSize(2).extractingResultOf("isUp").containsOnly(true); for (int i = 0; i < 10; i++) { ResultSet result = session().execute(select().from(tableName).where(eq("k", 0)).and(eq("c", 0))); assertThat(result.getAvailableWithoutFetching()).isEqualTo(1); } }
Source:
public void init() throws IOException { final Properties producerConfig = new Properties(); final Dictionary<String, Object> properties = configAdmin .getConfiguration(OpennmsKafkaProducer.KAFKA_CLIENT_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); producerConfig.put(key, properties.get(key)); } } producerConfig.put("key.serializer", StringSerializer.class.getCanonicalName()); producerConfig.put("value.serializer", ByteArraySerializer.class.getCanonicalName()); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(producerConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } LOG.info(" kafka producer initialized with ", producerConfig); }

Target:
public void init() throws IOException { final Properties producerConfig = new Properties(); final Dictionary<String, Object> properties = configAdmin .getConfiguration(OpennmsKafkaProducer.KAFKA_CLIENT_PID).getProperties(); if (properties != null) { final Enumeration<String> keys = properties.keys(); while (keys.hasMoreElements()) { final String key = keys.nextElement(); producerConfig.put(key, properties.get(key)); } } producerConfig.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getCanonicalName()); producerConfig.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, ByteArraySerializer.class.getCanonicalName()); final ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); producer = new KafkaProducer<>(producerConfig); } finally { Thread.currentThread().setContextClassLoader(currentClassLoader); } LOG.info(" kafka producer initialized with ", producerConfig); }
Source:
public void testStoreNotStarted() throws Exception { CloudBlobStore idleStore = new CloudBlobStore(partitionId, null, dest); List<StoreKey> keys = Collections.singletonList(getUniqueId(refAccountId, refContainerId)); MockMessageWriteSet messageWriteSet = new MockMessageWriteSet(); addBlobToSet(messageWriteSet, 10, Utils.Infinite_Time, refAccountId, refContainerId); try { idleStore.put(messageWriteSet); fail("Store put should have failed."); } catch (StoreException storex) { assertEquals(StoreErrorCodes.Store_Not_Started, storex.getErrorCode()); } try { idleStore.delete(messageWriteSet); fail("Store delete should have failed."); } catch (StoreException storex) { assertEquals(StoreErrorCodes.Store_Not_Started, storex.getErrorCode()); } try { idleStore.findMissingKeys(keys); fail("Store findMissingKeys should have failed."); } catch (StoreException storex) { assertEquals(StoreErrorCodes.Store_Not_Started, storex.getErrorCode()); } }

Target:
public void testStoreNotStarted() throws Exception { CloudBlobStore idleStore = new CloudBlobStore(partitionId, null, dest); List<StoreKey> keys = Collections.singletonList(getUniqueId(refAccountId, refContainerId)); MockMessageWriteSet messageWriteSet = new MockMessageWriteSet(); addBlobToSet(messageWriteSet, 10, Utils.Infinite_Time, refAccountId, refContainerId); try { idleStore.put(messageWriteSet); fail("Store put should have failed."); } catch (StoreException e) { assertEquals(StoreErrorCodes.Store_Not_Started, e.getErrorCode()); } try { idleStore.delete(messageWriteSet); fail("Store delete should have failed."); } catch (StoreException e) { assertEquals(StoreErrorCodes.Store_Not_Started, e.getErrorCode()); } try { idleStore.findMissingKeys(keys); fail("Store findMissingKeys should have failed."); } catch (StoreException e) { assertEquals(StoreErrorCodes.Store_Not_Started, e.getErrorCode()); } }
Source:
public void testFileForDiffDirectoryMismatch() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(PackageDeclarationCheck.class); final String[] expected = { "1: " + getCheckMessage(MSG_KEY_MISMATCH), }; verify(checkConfig, getNonCompilablePath("InputPackageDeclarationDiffDirectory.java"), expected); }

Target:
public void testFileForDiffDirectoryMismatch() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(PackageDeclarationCheck.class); final String[] expected = { "1:1: " + getCheckMessage(MSG_KEY_MISMATCH), }; verify(checkConfig, getNonCompilablePath("InputPackageDeclarationDiffDirectory.java"), expected); }
Source:
public void addUnmatchedTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "id")); lazyList.addTask(task); verify(taskList, never()).addTask(task); verify(taskList, never()).addTask(task, null); lazyList.commit(); verify(taskList, times(1)).addTask(task); lazyList.commit(); verify(taskList, times(1)).addTask(task); }

Target:
public void addUnmatchedTask() { AbstractTask task = spy(new TaskTask("kind", "repoUrl", "id")); lazyList.addTask(task); verify(taskList, never()).addTask(task); verify(taskList, never()).addTask(eq(task), any()); lazyList.commit(); verify(taskList).addTask(task); lazyList.commit(); verifyNoMoreInteractions(taskList); }
Source:
public synchronized V getValue() { if (value == null || isExpired()) { refreshValue(); } return value; }

Target:
public synchronized V getValue() { if (value == null || isExpired()) { return refreshValue(); } return value; }