auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void explicit_static_method_call() { Expression.Variable arg = UCFGBuilder.variableWithId("arg"); Expression.Variable var0 = UCFGBuilder.variableWithId("%0"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method(Ljava/lang/Integer;)I").addMethodParam(arg) .addStartingBlock( newBasicBlock("1") .assignTo(var0, call("java.lang.String#valueOf(Ljava/lang/Object;)Ljava/lang/String;").withArgs(new Expression.ClassName("java.lang.String"), arg), new LocationInFile(FILE_KEY, 3,11,3,30)) .ret(constant("\"\""), new LocationInFile(FILE_KEY, 3,4,3,31))) .build(); assertCodeToUCfg("class A { \n" + " int method(Integer arg) {\n" + " return String.valueOf(arg);\n" + " }\n" + "}", expectedUCFG); }

Target:
public void explicit_static_method_call() { Expression.Variable arg = UCFGBuilder.variableWithId("arg"); Expression.Variable aux0 = UCFGBuilder.variableWithId("%0"); UCFG expectedUCFG = UCFGBuilder.createUCFGForMethod("A#method(Ljava/lang/Integer;)Ljava/lang/String;") .addStartingBlock( newBasicBlock("1") .assignTo(aux0, call("java.util.Objects#toString(Ljava/lang/Object;)Ljava/lang/String;").withArgs(new Expression.ClassName("java.util.Objects"), arg), new LocationInFile(FILE_KEY, 3,11,3,42)) .ret(aux0, new LocationInFile(FILE_KEY, 3,4,3,43))) .build(); assertCodeToUCfg("class A { \n" + " String method(Integer arg) {\n" + " return java.util.Objects.toString(arg);\n" + " }\n" + "}", expectedUCFG); }
Source:
public static <E, K, V> TCollector<E, ?, Map<K, V>> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends V> valueMapper) { return TCollector.of(HashMap::new, (map, el) -> { K k = keyMapper.apply(el); V newV = TObjects.requireNonNull(valueMapper.apply(el)); V oldV = map.putIfAbsent(k, newV); if (oldV != null) { throw new IllegalStateException( "Key " + k + " corresponds to values " + oldV + " and " + newV); } }, (m1, m2) -> { m2.forEach((k, v) -> { V newV = TObjects.requireNonNull(v); V oldV = m1.putIfAbsent(k, newV); if (oldV != null) { throw new IllegalStateException( "Key " + k + " corresponds to values " + oldV + " and " + newV); } }); return m1; }, TCollector.Characteristics.IDENTITY_FINISH); }

Target:
public static <E, K, V> TCollector<E, ?, Map<K, V>> toMap(Function<? super E, ? extends K> keyMapper, Function<? super E, ? extends V> valueMapper) { return TCollector.of(HashMap::new, (map, el) -> { K k = keyMapper.apply(el); V newV = TObjects.requireNonNull(valueMapper.apply(el)); V oldV = map.putIfAbsent(k, newV); if (oldV != null) { throw new IllegalStateException( "Key " + k + " corresponds to values " + oldV + " and " + newV); } }, (m1, m2) -> { for (Map.Entry<K, V> e : m2.entrySet()) { V newV = TObjects.requireNonNull(e.getValue()); V oldV = m1.putIfAbsent(e.getKey(), newV); if (oldV != null) { throw new IllegalStateException( "Key " + e.getKey() + " corresponds to values " + oldV + " and " + newV); } } return m1; }, TCollector.Characteristics.IDENTITY_FINISH); }
Source:
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { ScheduledFuture<?> future = welcomeFuture; if (future != null && !future.isCancelled()) { future.cancel(true); } ctx.close(); }

Target:
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { ExecutorUtil.cancelScheduledFuture(welcomeFuture); ctx.close(); } }
Source:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case STUDENT_SUBMISSION: case STUDENT_RESULT: StudentAttributes studentAttributes = getStudentOfCourseFromRequest(courseId); checkAccessControlForStudentFeedbackSubmission(studentAttributes, feedbackSession); break; case FULL_DETAIL: gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), feedbackSession); break; case INSTRUCTOR_SUBMISSION: InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); checkAccessControlForInstructorFeedbackSubmission(instructorAttributes, feedbackSession); break; case INSTRUCTOR_RESULT: checkInstructorForSessionAccessPrivilege(feedbackSession); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }

Target:
public void checkSpecificAccessControl() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId); Intent intent = Intent.valueOf(getNonNullRequestParamValue(Const.ParamsNames.INTENT)); switch (intent) { case STUDENT_SUBMISSION: case STUDENT_RESULT: StudentAttributes studentAttributes = getStudentOfCourseFromRequest(courseId); checkAccessControlForStudentFeedbackSubmission(studentAttributes, feedbackSession); break; case FULL_DETAIL: gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), feedbackSession, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION); break; case INSTRUCTOR_SUBMISSION: InstructorAttributes instructorAttributes = getInstructorOfCourseFromRequest(courseId); checkAccessControlForInstructorFeedbackSubmission(instructorAttributes, feedbackSession); break; case INSTRUCTOR_RESULT: gateKeeper.verifyLoggedInUserPrivileges(); gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, userInfo.getId()), feedbackSession, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS); break; default: throw new InvalidHttpParameterException("Unknown intent " + intent); } }
Source:
public void setBitreserveRequestInterceptorWithNullTokenShouldSetTheBitreserveCustomHeadersWithoutAuthenticationHeader() throws Exception{ MockRestAdapter<Card> adapter = new MockRestAdapter<>(null, null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, Card>() { @Override public Promise<Card> call(BitreserveRestAdapter adapter) { User user = Fixtures.loadUser(); user.setBitreserveRestAdapter(adapter); return user.getCardById("foobar"); } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().size(), 3); Assert.assertTrue(request.getHeaders().contains(new Header("Accept", "application/json"))); Assert.assertFalse(request.getHeaders().contains(new Header("Authorization", "Basic Zm9vYmFyOlgtT0F1dGgtQmFzaWM="))); Assert.assertTrue(request.getHeaders().contains(new Header("Content-Type", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("User-Agent", "bitreserve-android-sdk 0.1 (<LINK_0>"))); }

Target:
public void setBitreserveRequestInterceptorWithNullTokenShouldSetTheBitreserveCustomHeadersWithoutAuthenticationHeader() throws Exception{ MockRestAdapter<Card> adapter = new MockRestAdapter<>(null, null, null); adapter.request(new RepromiseFunction<BitreserveRestAdapter, Card>() { @Override public Promise<Card> call(BitreserveRestAdapter adapter) { User user = Fixtures.loadUser(); user.setBitreserveRestAdapter(adapter); return user.getCardById("foobar"); } }); Request request = adapter.getRequest(); Assert.assertEquals(request.getHeaders().size(), 3); Assert.assertTrue(request.getHeaders().contains(new Header("Accept", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("Content-Type", "application/json"))); Assert.assertTrue(request.getHeaders().contains(new Header("User-Agent", "bitreserve-android-sdk 0.1 (<LINK_0>"))); }
Source:
public static String getStudioName(final String inputString) { if (inputString == null || inputString.isEmpty()) { return inputString; } StringBuilder outputString = new StringBuilder(); for (int i = 0; i < inputString.length(); i++) { Character c = inputString.charAt(i); outputString.append(Character.isUpperCase(c) && i > 0 ? "_" + c : c); } return outputString.toString().toUpperCase(Locale.ENGLISH); }

Target:
public static String getStudioName(final String inputString) { if (inputString == null || inputString.isEmpty()) { return ""; } StringBuilder outputString = new StringBuilder(); for (int i = 0; i < inputString.length(); i++) { Character c = inputString.charAt(i); outputString.append(Character.isUpperCase(c) && i > 0 ? "_" + c : c); } return outputString.toString().toUpperCase(Locale.ENGLISH); }
Source:
public Void call() throws Exception { ClientHttpResponse originalResponse = this.originalRequest.execute(); try { LOGGER.debug("Caching URI resource " + this.originalRequest.getURI()); this.response = new CachedClientHttpResponse(originalResponse); } finally { originalResponse.close(); } return null; }

Target:
public Void call() throws Exception { final String baseMetricName = HttpRequestCache.class.getName() + ".read." + getURI().getHost(); final Timer.Context timerDownload = HttpRequestCache.this.registry.timer(baseMetricName).time(); ClientHttpResponse originalResponse = this.originalRequest.execute(); try { LOGGER.debug("Caching URI resource " + this.originalRequest.getURI()); this.response = new CachedClientHttpResponse(originalResponse); } catch (IOException e) { HttpRequestCache.this.registry.counter(baseMetricName + ".error").inc(); throw e; } finally { originalResponse.close(); timerDownload.stop(); } return null; }
Source:
protected String encodeAccessToken(final AccessToken accessToken, final OAuth20AccessTokenResponseResult result) { return OAuth20Utils.encodeAccessToken(accessToken); }

Target:
protected String encodeAccessToken(final AccessToken accessToken, final OAuth20AccessTokenResponseResult result) { return OAuth20Utils.responseAccessToken(accessToken); }
Source:
final CompletableFuture<Void> removeLifespanExpired(K key, V value, Long lifespan, long explicitFlags) { long flagBitSet = explicitFlags | FlagBitSets.SKIP_CACHE_LOAD | FlagBitSets.SKIP_SHARED_CACHE_STORE | FlagBitSets.SKIP_XSITE_BACKUP; RemoveExpiredCommand command = commandsFactory.buildRemoveExpiredCommand(key, value, keyPartitioner.getSegment(key), lifespan, flagBitSet); CompletableFuture<Boolean> completableFuture = performRemoveExpiredCommand(command); return completableFuture.thenApply(b -> null); }

Target:
final CompletableFuture<Void> removeLifespanExpired(K key, V value, Long lifespan, long explicitFlags) { RemoveExpiredCommand command = commandsFactory.buildRemoveExpiredCommand(key, value, keyPartitioner.getSegment(key), lifespan, explicitFlags | FlagBitSets.SKIP_CACHE_LOAD | FlagBitSets.SKIP_XSITE_BACKUP); CompletableFuture<Boolean> completableFuture = performRemoveExpiredCommand(command); return completableFuture.thenApply(b -> null); }
Source:
public long getCas(final Object entity) { final ConvertingPropertyAccessor<Object> accessor = getPropertyAccessor(entity); final CouchbasePersistentEntity<?> persistentEntity = mappingContext.getRequiredPersistentEntity(entity.getClass()); final CouchbasePersistentProperty versionProperty = persistentEntity.getVersionProperty(); long cas = 0; if (versionProperty != null) { cas = (long) accessor.getProperty(versionProperty); } return cas; }

Target:
public long getCas(final Object entity) { final ConvertingPropertyAccessor<Object> accessor = getPropertyAccessor(entity); final CouchbasePersistentEntity<?> persistentEntity = mappingContext.getRequiredPersistentEntity(entity.getClass()); final CouchbasePersistentProperty versionProperty = persistentEntity.getVersionProperty(); long cas = 0; if (versionProperty != null) { Object casObject = (Number)accessor.getProperty(versionProperty); if (casObject instanceof Number){ cas = ((Number)casObject).longValue(); } } return cas; }
Source:
public boolean notify(Throwable throwable, Severity severity) { if (throwable == null) { LOGGER.warn("Tried to notify with a null Throwable"); return false; } Report report = buildReport(throwable); report.setSeverity(severity); return notify(report); }

Target:
public boolean notify(Throwable throwable, Severity severity) { return notify(throwable, severity, null); }
Source:
private void getStyleFromValue( View element, String name, Object value, @Nullable ViewDebug.ExportedProperty annotation, StyleAccumulator styles) { if (name.equals(ID_NAME)) { getIdStyle(element, styles); } else if (value instanceof Integer) { getStyleFromInteger(name, (Integer) value, annotation, styles); } else if (value instanceof Float) { getStyleFromFloat(name, (Float) value, annotation, styles); } else if (value instanceof Boolean) { getStyleFromBoolean(name, (Boolean) value, annotation, styles); } else if (value instanceof Short) { getStyleFromShort(name, (Short) value, annotation, styles); } else if (value instanceof Long) { getStyleFromLong(name, (Long) value, annotation, styles); } else if (value instanceof Double) { getStyleFromDouble(name, (Double) value, annotation, styles); } else if (value instanceof Byte) { getStyleFromByte(name, (Byte) value, annotation, styles); } else if (value instanceof CharSequence) { getStyleFromCharSequence(name, (CharSequence) value, annotation, styles); } else { getStylesFromObject(element, name, value, annotation, styles); } }

Target:
private void getStyleFromValue( View element, String name, Object value, @Nullable ViewDebug.ExportedProperty annotation, StyleAccumulator styles) { if (name.equals(ID_NAME)) { getIdStyle(element, styles); } else if (value instanceof Integer) { getStyleFromInteger(name, (Integer) value, annotation, styles); } else if (value instanceof Float) { styles.store(name, String.valueOf(value), ((Float) value) == 0.0f); } else if (value instanceof Boolean) { styles.store(name, String.valueOf(value), false); } else if (value instanceof Short) { styles.store(name, String.valueOf(value), ((Short) value) == 0); } else if (value instanceof Long) { styles.store(name, String.valueOf(value), ((Long) value) == 0); } else if (value instanceof Double) { styles.store(name, String.valueOf(value), ((Double) value) == 0.0d); } else if (value instanceof Byte) { styles.store(name, String.valueOf(value), ((Byte) value) == 0); } else if (value instanceof Character) { styles.store(name, String.valueOf(value), ((Character) value) == Character.MIN_VALUE); } else if (value instanceof CharSequence) { styles.store(name, String.valueOf(value), ((CharSequence) value).length() == 0); } else { getStylesFromObject(element, name, value, annotation, styles); } }
Source:
public Datastream create(@ActionParam("boostrapDatastream") Datastream bootstrapDatastream) { try { LOG.info(String.format("Create bootstrap datastream called with datastream %s", bootstrapDatastream)); CREATE_CALL.inc(); if (!bootstrapDatastream.hasName()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify name of Datastream!"); } if (!bootstrapDatastream.hasConnectorName()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify connectorType!"); } if (!bootstrapDatastream.hasSource()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify source of Datastream!"); } Instant startTime = Instant.now(); try { _coordinator.initializeDatastream(bootstrapDatastream); _store.createDatastream(bootstrapDatastream.getName(), bootstrapDatastream); } catch (DatastreamAlreadyExistsException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_409_CONFLICT, "Failed to create bootstrap datastream: " + bootstrapDatastream, e); } synchronized (_createCallLatencyMs) { _createCallLatencyMs = Duration.between(startTime, Instant.now()).toMillis(); } return bootstrapDatastream; } catch (RestLiServiceException e) { CALL_ERROR.inc(); throw e; } catch (Exception e) { CALL_ERROR.inc(); _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, String.format("Failed to initialize bootstrap Datastream %s", bootstrapDatastream), e); } return null; }

Target:
public Datastream create(@ActionParam("boostrapDatastream") Datastream bootstrapDatastream) { try { LOG.info(String.format("Create bootstrap datastream called with datastream %s", bootstrapDatastream)); CREATE_CALL.inc(); if (!bootstrapDatastream.hasName()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify name of Datastream!"); } if (!bootstrapDatastream.hasConnectorName()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify connectorType!"); } if (!bootstrapDatastream.hasSource()) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_400_BAD_REQUEST, "Must specify source of Datastream!"); } Instant startTime = Instant.now(); try { _coordinator.initializeDatastream(bootstrapDatastream); _store.createDatastream(bootstrapDatastream.getName(), bootstrapDatastream); } catch (DatastreamAlreadyExistsException e) { _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_409_CONFLICT, "Failed to create bootstrap datastream: " + bootstrapDatastream, e); } _createCallLatencyMs.set(Duration.between(startTime, Instant.now()).toMillis()); return bootstrapDatastream; } catch (RestLiServiceException e) { CALL_ERROR.inc(); throw e; } catch (Exception e) { CALL_ERROR.inc(); _errorLogger.logAndThrowRestLiServiceException(HttpStatus.S_500_INTERNAL_SERVER_ERROR, String.format("Failed to initialize bootstrap Datastream %s", bootstrapDatastream), e); } return null; }
Source:
public static URLClassLoader getClassLoaderForExtension(File extension) throws MalformedURLException { URLClassLoader loader = LOADERS_MAP.get(extension); if (loader == null) { LOADERS_MAP.putIfAbsent( extension, new URLClassLoader(new URL[]{extension.toURL()}, Initialization.class.getClassLoader()) ); loader = LOADERS_MAP.get(extension); } return loader; }

Target:
public static URLClassLoader getClassLoaderForExtension(File extension) throws MalformedURLException { URLClassLoader loader = loadersMap.get(extension.getName()); if (loader == null) { final Collection<File> jars = FileUtils.listFiles(extension, new String[]{"jar"}, false); final URL[] urls = new URL[jars.size()]; int i = 0; for (File jar : jars) { final URL url = jar.toURI().toURL(); log.info("added URL[%s]", url); urls[i++] = url; } loadersMap.putIfAbsent(extension, new URLClassLoader(urls, Initialization.class.getClassLoader())); loader = loadersMap.get(extension); } return loader; }
Source:
public boolean isUniqueIdentifier(String userIdentifier, String protocol, String authority, String separator) { String query = "SELECT d FROM Dataset d WHERE d.identifier = '" + userIdentifier + "'"; query += " and d.protocol ='" + protocol + "'"; query += " and d.authority = '" + authority + "'"; boolean u = em.createQuery(query).getResultList().size() == 0; String nonNullDefaultIfKeyNotFound = ""; String doiProvider = settingsService.getValueForKey(SettingsServiceBean.Key.DoiProvider, nonNullDefaultIfKeyNotFound); if (protocol.equals("doi") && doiProvider.equals("EZID")) { if (!doiEZIdServiceBean.lookupMetadataFromIdentifier(protocol, authority, separator, userIdentifier).isEmpty()) { u = false; } } return u; }

Target:
public boolean isUniqueIdentifier(String userIdentifier, String protocol, String authority, String separator) { String query = "SELECT d FROM Dataset d WHERE d.identifier = '" + userIdentifier + "'"; query += " and d.protocol ='" + protocol + "'"; query += " and d.authority = '" + authority + "'"; boolean u = em.createQuery(query).getResultList().size() == 0; String nonNullDefaultIfKeyNotFound = ""; String doiProvider = settingsService.getValueForKey(SettingsServiceBean.Key.DoiProvider, nonNullDefaultIfKeyNotFound); if (protocol.equals(doi.toString()) && doiProvider.equals(EZID.toString())) { if (!doiEZIdServiceBean.lookupMetadataFromIdentifier(protocol, authority, separator, userIdentifier).isEmpty()) { u = false; } } return u; }
Source:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("[TimeLineEvent Values=").append(getValues()) .append(", Entry=").append(getEntry()) .append(", fTime=").append(getTime()) .append(", Duration=").append(getDuration()) .append(']'); return builder.toString(); }

Target:
public String toString() { return new StringBuilder().append("[TimeLineEvent Values=").append(getValues()) .append(", Entry=").append(getEntry()) .append(", fTime=").append(getTime()) .append(", Duration=").append(getDuration()) .append(']').toString(); }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (!(object instanceof DoubleStateValue)) { return -1; } DoubleStateValue other = (DoubleStateValue) object; return Double.compare(this.value, other.value); }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: double otherDoubleValue = ((IntegerStateValue) object).unboxInt(); result = Double.compare(this.value, otherDoubleValue); break; case DOUBLE: otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: otherDoubleValue = ((LongStateValue) object).unboxLong(); result = Double.compare(this.value, otherDoubleValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
static List<Integer> getIntervalStartPositions(final int[] scanPayload) { final List<Integer> intervalStarts = new ArrayList<Integer>(); intervalStarts.add( 0 ); boolean foundFF = false; boolean foundD0toD7 = false; int pos = 0; while ( pos < scanPayload.length ) { if ( foundFF == true ) { if ( scanPayload[ pos ] >= ( 0xff & JpegConstants.RST0_MARKER ) && scanPayload[ pos ] <= ( 0xff & JpegConstants.RST7_MARKER ) ) { foundD0toD7 = true; } else { foundFF = false; } } if ( scanPayload[ pos ] == 0xFF ) { foundFF = true; } if ( foundFF == true && foundD0toD7 == true ) { intervalStarts.add( pos + 1 ); foundFF = foundD0toD7 = false; } pos++; } return intervalStarts; }

Target:
static List<Integer> getIntervalStartPositions(final int[] scanPayload) { final List<Integer> intervalStarts = new ArrayList<Integer>(); intervalStarts.add(0); boolean foundFF = false; boolean foundD0toD7 = false; int pos = 0; while (pos < scanPayload.length) { if (foundFF) { if (scanPayload[pos] >= (0xff & JpegConstants.RST0_MARKER) && scanPayload[pos] <= (0xff & JpegConstants.RST7_MARKER)) { foundD0toD7 = true; } else { foundFF = false; } } if (scanPayload[pos] == 0xFF) { foundFF = true; } if (foundFF && foundD0toD7) { intervalStarts.add(pos + 1); foundFF = foundD0toD7 = false; } pos++; } return intervalStarts; }
Source:
private void init() { if (!ServerType.MONITORING.equals(ServerType.getServerType())) { runWithLock(() -> { migrateDatasets(); migratePerspectives(); migrateNavigation(); }); } }

Target:
protected void init() { if (this.isMigrationEnabled()) { runWithLock(() -> { migrateDatasets(); migratePerspectives(); migrateNavigation(); }); } }
Source:
public Integer getNumberOfDays(Interval interval) { Interval overlap = getInterval().overlap(interval); return overlap == null ? 0 : Days.daysBetween(overlap.getStart(), overlap.getEnd()).getDays(); }

Target:
public Integer getNumberOfDays(Interval interval) { Interval overlap = getInterval().overlap(interval); return overlap == null ? 0 : Days.daysBetween(overlap.getStart().toLocalDate(), overlap.getEnd().toLocalDate()).getDays(); }
Source:
public Optional<StatisticType> getById(String id) { return Optional.ofNullable(this.universalStatisticMappings.get(id.toLowerCase())); }

Target:
public Optional<StatisticType> getById(String id) { return Optional.ofNullable(this.statisticTypeMappings.get(id.toLowerCase(Locale.ENGLISH))); }
Source:
private String getSubmissionFormMobileHtml(String questionNumberString, String responseNumberString, boolean sessionIsOpen, boolean isExistingResponse, FeedbackRubricResponseDetails frd) { StringBuilder mobileHtml = new StringBuilder(); String mobilePanelTemplate = FeedbackQuestionFormTemplates.RUBRIC_SUBMISSION_FORM_MOBILE_PANEL; String mobilePanelFragmentTemplate = FeedbackQuestionFormTemplates.RUBRIC_SUBMISSION_FORM_MOBILE_PANEL_FRAGMENT; for (int i = 0; i < numOfRubricSubQuestions; i++) { StringBuilder panelBody = new StringBuilder(); for (int j = 0; j < numOfRubricChoices; j++) { String panelBodyFragment = FeedbackQuestionFormTemplates.populateTemplate(mobilePanelFragmentTemplate, "${qnIndex}", questionNumberString, "${respIndex}", responseNumberString, "${col}", Integer.toString(j), "${row}", Integer.toString(i), "${disabled}", sessionIsOpen ? "" : "disabled", "${description}", Sanitizer.sanitizeForHtml(this.getDescription(i, j)), "${checked}", isExistingResponse && frd.getAnswer(i) == j ? "checked" : "", "${rubricChoiceValue}", Sanitizer.sanitizeForHtml(rubricChoices.get(j)), "${Const.ParamsNames.FEEDBACK_QUESTION_RUBRICCHOICE}", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE); panelBody.append(panelBodyFragment); } String panel = FeedbackQuestionFormTemplates.populateTemplate(mobilePanelTemplate, "${panelBody}", panelBody.toString(), "${subQuestion}", StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1) + ") " + Sanitizer.sanitizeForHtml(rubricSubQuestions.get(i))); mobileHtml.append(panel).append(Const.EOL); } return mobileHtml.toString(); }

Target:
private String getSubmissionFormMobileHtml(String questionNumberString, String responseNumberString, boolean sessionIsOpen, boolean isExistingResponse, FeedbackRubricResponseDetails frd) { StringBuilder mobileHtml = new StringBuilder(); String mobilePanelTemplate = FeedbackQuestionFormTemplates.RUBRIC_SUBMISSION_FORM_MOBILE_PANEL; String mobilePanelFragmentTemplate = FeedbackQuestionFormTemplates.RUBRIC_SUBMISSION_FORM_MOBILE_PANEL_FRAGMENT; for (int i = 0; i < numOfRubricSubQuestions; i++) { StringBuilder panelBody = new StringBuilder(); for (int j = 0; j < numOfRubricChoices; j++) { String panelBodyFragment = Templates.populateTemplate(mobilePanelFragmentTemplate, "${qnIndex}", questionNumberString, "${respIndex}", responseNumberString, "${col}", Integer.toString(j), "${row}", Integer.toString(i), "${disabled}", sessionIsOpen ? "" : "disabled", "${description}", Sanitizer.sanitizeForHtml(this.getDescription(i, j)), "${checked}", isExistingResponse && frd.getAnswer(i) == j ? "checked" : "", "${rubricChoiceValue}", Sanitizer.sanitizeForHtml(rubricChoices.get(j)), "${Const.ParamsNames.FEEDBACK_QUESTION_RUBRICCHOICE}", Const.ParamsNames.FEEDBACK_QUESTION_RUBRIC_CHOICE); panelBody.append(panelBodyFragment); } String panel = Templates.populateTemplate(mobilePanelTemplate, "${panelBody}", panelBody.toString(), "${subQuestion}", StringHelper.integerToLowerCaseAlphabeticalIndex(i + 1) + ") " + Sanitizer.sanitizeForHtml(rubricSubQuestions.get(i))); mobileHtml.append(panel).append(Const.EOL); } return mobileHtml.toString(); }
Source:
private void setNew(Change c, ChangeMessage msg) { for (int attempts = 0; attempts < 10; attempts++) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); try { final Transaction txn = schema.beginTransaction(); schema.changes().update(Collections.singleton(c), txn); if (msg != null) { schema.changeMessages().insert(Collections.singleton(msg), txn); } txn.commit(); break; } catch (OrmException e) { try { c = schema.changes().get(c.getId()); if (c.getStatus().isClosed()) { break; } } catch (OrmException e2) { } } } try { final ChangeMail cm = new ChangeMail(server, c); cm.setFrom(getSubmitter(c)); cm.setReviewDb(schema); cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema .patchSetInfo().get(c.currentPatchSetId())); if (msg.getMessage().indexOf("path conflict") == -1) { cm.sendMergeFailed(null); } else { cm.sendMergeFailed("path conflict"); } } catch (OrmException e) { log.error("Cannot send email for submitted patch set " + c.getId(), e); } catch (MessagingException e) { log.error("Cannot send email for submitted patch set " + c.getId(), e); } }

Target:
private void setNew(Change c, ChangeMessage msg) { for (int attempts = 0; attempts < 10; attempts++) { c.setStatus(Change.Status.NEW); ChangeUtil.updated(c); try { final Transaction txn = schema.beginTransaction(); schema.changes().update(Collections.singleton(c), txn); if (msg != null) { schema.changeMessages().insert(Collections.singleton(msg), txn); } txn.commit(); break; } catch (OrmException e) { try { c = schema.changes().get(c.getId()); if (c.getStatus().isClosed()) { break; } } catch (OrmException e2) { } } } try { final ChangeMail cm = new ChangeMail(server, c); cm.setFrom(getSubmitter(c)); cm.setReviewDb(schema); cm.setPatchSet(schema.patchSets().get(c.currentPatchSetId()), schema .patchSetInfo().get(c.currentPatchSetId())); cm.setChangeMessage(msg); cm.sendMergeFailed(); } catch (OrmException e) { log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e); } catch (MessagingException e) { log.error("Cannot submit patch set for Change " + c.getId() + " due to a path conflict.", e); } }
Source:
private boolean waitManagedProfileProvisioning() throws InterruptedException { BlockingBroadcastReceiver managedProfileProvisionedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED); BlockingBroadcastReceiver managedProfileAddedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED); try { managedProfileProvisionedReceiver.register(); managedProfileAddedReceiver.register(); if (!pollProvisioningResult()) { return false; } mReceivedProfileProvisionedIntent = managedProfileProvisionedReceiver.awaitForBroadcast(TIMEOUT_SECONDS * 1000); if (mReceivedProfileProvisionedIntent == null) { Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed"); return false; } if (managedProfileAddedReceiver.awaitForBroadcast(TIMEOUT_SECONDS * 1000) == null) { Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed"); return false; } } finally { managedProfileProvisionedReceiver.unregisterQuietly(); managedProfileAddedReceiver.unregisterQuietly(); } return true; }

Target:
private boolean waitManagedProfileProvisioning() throws InterruptedException { BlockingBroadcastReceiver managedProfileProvisionedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED); BlockingBroadcastReceiver managedProfileAddedReceiver = new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED); try { managedProfileProvisionedReceiver.register(); managedProfileAddedReceiver.register(); if (!pollProvisioningResult()) { return false; } mReceivedProfileProvisionedIntent = managedProfileProvisionedReceiver.awaitForBroadcast( TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS)); if (mReceivedProfileProvisionedIntent == null) { Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed"); return false; } if (managedProfileAddedReceiver.awaitForBroadcast( TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS)) == null) { Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed"); return false; } } finally { managedProfileProvisionedReceiver.unregisterQuietly(); managedProfileAddedReceiver.unregisterQuietly(); } return true; }
Source:
public void setUp() { if (isNullOrEmpty(POSTGRESQL)) { throw new IllegalStateException("Environment variable `DIGDAG_TEST_POSTGRESQL` isn't set"); } props = new Properties(); try (StringReader reader = new StringReader(POSTGRESQL)) { props.load(reader); } catch (IOException ex) { throw Throwables.propagate(ex); } database = "pgoptest_" + UUID.randomUUID().toString().replace('-', '_'); createTempDatabase(props, database); setupRestrictedUser(props, database); setupSourceTable(props, database); }

Target:
public void setUp() { assumeThat(POSTGRESQL, not(isEmptyOrNullString())); props = new Properties(); try (StringReader reader = new StringReader(POSTGRESQL)) { props.load(reader); } catch (IOException ex) { throw Throwables.propagate(ex); } database = "pgoptest_" + UUID.randomUUID().toString().replace('-', '_'); createTempDatabase(props, database); setupRestrictedUser(props, database); setupSourceTable(props, database); }
Source:
private static String toString(ToStringStyle style) { ToStringTreeBuilder builder = new ToStringTreeBuilder( style ); return builder.attribute( "foo", "value" ) .startObject( "children" ) .attribute( "childrenFoo", 23 ) .startObject( "child1" ) .attribute( "child1Foo", new Object() { @Override public String toString() { return "customToString"; } } ) .startList() .value( "foo" ) .value( 42 ) .endList() .endObject() .startObject( "emptyChild" ) .endObject() .attribute( "appendable", new Appendable() ) .attribute("appendableAsObject", new Appendable()) .attribute("nullAppendable", null) .startList( "list" ) .startObject() .attribute( "name", "foo" ) .endObject() .startObject( "object" ) .attribute( "name", "foo" ) .attribute( "attr", "bar" ) .endObject() .startObject() .startList( "nestedList" ) .value( "first" ) .value( "second" ) .endList() .attribute( "name", "bar" ) .endObject() .endList() .endObject() .attribute( "bar", "value" ) .toString(); }

Target:
private static String toString(ToStringStyle style) { ToStringTreeBuilder builder = new ToStringTreeBuilder( style ); return builder.attribute( "foo", "value" ) .startObject( "children" ) .attribute( "childrenFoo", 23 ) .startObject( "child1" ) .attribute( "child1Foo", new Object() { @Override public String toString() { return "customToString"; } } ) .startList() .value( "foo" ) .value( 42 ) .endList() .endObject() .startObject( "emptyChild" ) .endObject() .attribute( "appendable", new Appendable() ) .attribute( "appendableAsObject" , (Object) new Appendable() ) .attribute( "nullAppendable" , null) .startList( "list" ) .startObject() .attribute( "name", "foo" ) .endObject() .startObject( "object" ) .attribute( "name", "foo" ) .attribute( "attr", "bar" ) .endObject() .startObject() .startList( "nestedList" ) .value( "first" ) .value( "second" ) .endList() .attribute( "name", "bar" ) .endObject() .endList() .endObject() .attribute( "bar", "value" ) .toString(); }
Source:
void generateParameterValueSet(ActivationClassBuilder acb) throws StandardException { Vector parameterList = getCompilerContext().getParameterList(); int numberOfParameters = (parameterList == null) ? 0 : parameterList.size(); if (numberOfParameters < 0) return; ParameterNode.generateParameterValueSet (acb, numberOfParameters, parameterList); }

Target:
void generateParameterValueSet(ActivationClassBuilder acb) throws StandardException { Vector parameterList = getCompilerContext().getParameterList(); int numberOfParameters = (parameterList == null) ? 0 : parameterList.size(); ParameterNode.generateParameterValueSet (acb, numberOfParameters, parameterList); }
Source:
public RMState getState() throws NotConnectedException { return rm.getState(sessionId); }

Target:
public RMState getState() throws NotConnectedException { checkNonEmptySession(); return rm.getState(sessionId); }
Source:
protected void registerFactorFilter(FactorFilter<T,V> filter){ if (null == filter ) { logger.info("skipping registerFactorFilter as the comaractor is null or has an invalid weight value."); return; } this.factorFilterList.put(filter.getFactorName(),filter); logger.info(String.format("Factor filter added for '%s'.", filter.getFactorName())); }

Target:
protected void registerFactorFilter(FactorFilter<T,V> filter){ if (null == filter ) { throw new IllegalArgumentException("unable to register factor filter. " + "The passed comaractor is null or has an invalid weight value."); } this.factorFilterList.put(filter.getFactorName(),filter); logger.info(String.format("Factor filter added for '%s'.", filter.getFactorName())); }
Source:
protected void execute() { final boolean pass = buildResult.isBetterOrEqualTo(hudson.model.Result.SUCCESS); info(String.format("Sending diffusion result as: %s", buildResult.toString())); try { harbormaster.sendHarbormasterUri(phid, buildUrl); harbormaster.sendHarbormasterMessage(phid, pass ? MessageType.pass : MessageType.fail, null, null, null); result = Result.SUCCESS; return; } catch (ConduitAPIException e) { e.printStackTrace(logger.getStream()); } catch (IOException e) { e.printStackTrace(logger.getStream()); } result = Result.FAILURE; }

Target:
protected void execute() { MessageType messageType; if (this.sendPartialResults) { messageType = MessageType.work; } else if (buildResult.isBetterOrEqualTo(hudson.model.Result.SUCCESS)) { messageType = MessageType.pass; } else { messageType = MessageType.fail; } info(String.format("Sending diffusion result as: %s, message type: %s", buildResult.toString(), messageType.name())); try { harbormaster.sendHarbormasterUri(phid, buildUrl); harbormaster.sendHarbormasterMessage(phid, messageType, null, null, null); result = Result.SUCCESS; return; } catch (ConduitAPIException e) { e.printStackTrace(logger.getStream()); } catch (IOException e) { e.printStackTrace(logger.getStream()); } result = Result.FAILURE; }
Source:
public void runApplication() throws Exception { Configuration conf = new Configuration(false); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); super.populateDAG(dag, conf); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { } }; lma.prepareDAG(app, conf); tupleCount = 0; final LocalMode.Controller lc = lma.getController(); lc.runAsync(); while (tupleCount < tupleSize) { try { Thread.sleep(500); } catch (Exception e) { } } lc.shutdown(); Assert.assertTrue("setupTimes: " + setupTimes, setupTimes == 2); }

Target:
public void runApplication() throws Exception { Configuration conf = new Configuration(false); LocalMode lma = LocalMode.newInstance(); DAG dag = lma.getDAG(); super.populateDAG(dag, conf); StreamingApplication app = new StreamingApplication() { @Override public void populateDAG(DAG dag, Configuration conf) { } }; lma.prepareDAG(app, conf); tupleCount = 0; final LocalMode.Controller lc = lma.getController(); lc.runAsync(); long endTime = System.currentTimeMillis() + atMostRunTime; while (tupleCount < tupleSize && System.currentTimeMillis() < endTime) { try { Thread.sleep(500); } catch (Exception e) { } } lc.shutdown(); Assert.assertTrue("Expect call setup() twice, Actually called " + setupTimes + " times", setupTimes == 2); }
Source:
public void testWriteBehindMultipleClients() throws Exception { PersistentCacheManager cacheManager1 = createCacheManager(); PersistentCacheManager cacheManager2 = createCacheManager(); Cache<Long, String> client1 = cacheManager1.getCache(CACHE_NAME, Long.class, String.class); Cache<Long, String> client2 = cacheManager2.getCache(CACHE_NAME, Long.class, String.class); client1.put(KEY, "The one from client1"); client2.put(KEY, "The one one from client2"); assertValue(client1, "The one one from client2"); client1.remove(KEY); client2.put(KEY, "The one from client2"); client1.put(KEY, "The one one from client1"); assertValue(client2, "The one one from client1"); client2.remove(KEY); assertValue(client1, null); client1.put(KEY, "The one from client1"); client1.put(KEY, "The one one from client1"); client2.remove(KEY); client2.put(KEY, "The one from client2"); client2.put(KEY, "The one one from client2"); client1.remove(KEY); assertValue(client2, null); CLUSTER.getClusterControl().terminateActive(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().startOneServer(); assertValue(client1, null); assertValue(client2, null); checkValueFromLoaderWriter(client1, null); client1.clear(); }

Target:
public void testWriteBehindMultipleClients() throws Exception { PersistentCacheManager cacheManager1 = createCacheManager(); PersistentCacheManager cacheManager2 = createCacheManager(); Cache<Long, String> client1 = cacheManager1.getCache(CACHE_NAME, Long.class, String.class); Cache<Long, String> client2 = cacheManager2.getCache(CACHE_NAME, Long.class, String.class); client1.put(KEY, "The one from client1"); client2.put(KEY, "The one from client2"); assertValue(client1, "The one from client2"); client1.remove(KEY); client2.put(KEY, "The one from client2"); client1.put(KEY, "The one from client1"); assertValue(client2, "The one from client1"); client2.remove(KEY); assertValue(client1, null); client1.put(KEY, "The one from client1"); client1.put(KEY, "The one one from client1"); assertValue(client2, "The one one from client1"); client2.remove(KEY); assertValue(client1, null); client2.put(KEY, "The one from client2"); client2.put(KEY, "The one one from client2"); assertValue(client1, "The one one from client2"); client1.remove(KEY); assertValue(client2, null); CLUSTER.getClusterControl().terminateActive(); CLUSTER.getClusterControl().waitForActive(); CLUSTER.getClusterControl().startOneServer(); Thread.sleep(1000); assertValue(client1, null); assertValue(client2, null); checkValueFromLoaderWriter(client1, null); client1.clear(); }
Source:
public User getUser(String uniqueId, AbstractUserStoreManager userStoreManager) throws UserStoreException { String userName = userStoreManager.getFromUserNameCache(uniqueId); if (StringUtils.isEmpty(userName)) { String[] usernames = userStoreManager.getUserList(UserCoreClaimConstants.USER_ID_CLAIM_URI, uniqueId, null); if (usernames.length > 1) { throw new UserStoreException("More than one user presents with the same user unique id."); } if (usernames.length == 0) { return null; } userName = usernames[0]; UserStore userStore = userStoreManager.getUserStoreWithID(uniqueId); String[] userNames = userName.split(CarbonConstants.DOMAIN_SEPARATOR); String domainFreeUserName; if (userNames.length > 1) { domainFreeUserName = userNames[1]; } else { domainFreeUserName = userName; } userStoreManager.addToUserNameCache(uniqueId, domainFreeUserName, userStore); userStoreManager.addToUserIDCache(uniqueId, domainFreeUserName, userStore); } User user = new User(); user.setUserID(uniqueId); user.setUsername(UserCoreUtil.removeDomainFromName(userName)); user.setUserStoreDomain(UserCoreUtil.extractDomainFromName(userName)); return user; }

Target:
public User getUser(String uniqueId, AbstractUserStoreManager userStoreManager) throws UserStoreException { String userName = getFromUserNameCache(uniqueId); if (StringUtils.isEmpty(userName)) { String[] usernames = userStoreManager.getUserList(UserCoreClaimConstants.USER_ID_CLAIM_URI, uniqueId, null); if (usernames.length > 1) { throw new UserStoreException("More than one user presents with the same user unique id."); } if (usernames.length == 0) { return null; } userName = usernames[0]; addToUserNameCache(uniqueId, userName); addToUserIDCache(uniqueId, userName); } User user = new User(); user.setUserID(uniqueId); user.setUsername(UserCoreUtil.removeDomainFromName(userName)); user.setUserStoreDomain(UserCoreUtil.extractDomainFromName(userName)); return user; }
Source:
protected String doTaskBackground(Void... params) { final Uri SMS_INBOX = Uri.parse("content://sms/inbox"); DateTime oneDayAgo = (new DateTime()).minusDays(7); Cursor cursor = contentResolver.query(SMS_INBOX, null, "date >? ", new String[]{"" + oneDayAgo.getMillis()}, "date DESC"); int messageIterationCount = 0; if (cursor != null) { try { while (cursor.moveToNext() && messageIterationCount <= SMS_CHECK_COUNT) { messageIterationCount++; String textMessageBody = cursor.getString(cursor.getColumnIndex("body")); if (textMessageBody.contains(GlobalConstants.SMS_INSTALL_KEY_STRING)) { return processSMS(textMessageBody); } } } finally { cursor.close(); } } return null; }

Target:
protected String doTaskBackground(Void... params) { final Uri SMS_INBOX = Uri.parse("content://sms/inbox"); DateTime oneWeekAgo = (new DateTime()).minusDays(7); Cursor cursor = contentResolver.query(SMS_INBOX, null, "date >? ", new String[]{"" + oneWeekAgo.getMillis()}, "date DESC"); int messageIterationCount = 0; if (cursor != null) { try { while (cursor.moveToNext() && messageIterationCount <= SMS_CHECK_COUNT) { messageIterationCount++; String textMessageBody = cursor.getString(cursor.getColumnIndex("body")); if (textMessageBody.contains(GlobalConstants.SMS_INSTALL_KEY_STRING)) { return processSMS(textMessageBody); } } } finally { cursor.close(); } } return null; }
Source:
private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { JSONObject extensionDetailJson; if (StringUtils.isNotBlank(extensionName)) { extensionDetailJson = getExtensionDetailJson(extensionName); } else { extensionDetailJson = getExtensionJobDetailJson(jobName); } String extensionType = ExtensionHandler.getExtensionType(extensionName, extensionDetailJson); String extensionBuildLocation = ExtensionHandler.getExtensionLocation(extensionName, extensionDetailJson); return getEntities(extensionName, jobName, configStream, extensionType, extensionBuildLocation); }

Target:
private List<Entity> validateExtensionAndGetEntities(String extensionName, String jobName, InputStream configStream) { JSONObject extensionDetailJson; if (StringUtils.isBlank(extensionName)) { extensionName = ExtensionHandler.getExtensionName(jobName, getExtensionJobDetailJson(jobName)); } extensionDetailJson = getExtensionDetailJson(extensionName); String extensionType = ExtensionHandler.getExtensionType(extensionName, extensionDetailJson); String extensionBuildLocation = ExtensionHandler.getExtensionLocation(extensionName, extensionDetailJson); return getEntities(extensionName, jobName, configStream, extensionType, extensionBuildLocation); }
Source:
private Text createFilterTextArea(Composite parent, Composite container, Composite labels) { Text filterText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.widthHint = FIND_X_WIDTH_HINT; filterText.setLayoutData(gridData); if (fRegex != null) { filterText.setText(fRegex); } Color background = filterText.getBackground(); filterText.addModifyListener(e -> { fRegex = filterText.getText(); filterText.setBackground(background); fView.restartZoomThread(); while(fView.isDirty()) }); filterText.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { handleEnterPressed(parent, labels, filterText); fView.restartZoomThread(); } } }); return filterText; }

Target:
private Text createFilterTextArea(Composite parent, Composite container, Composite labels) { Text filterText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_CANCEL | SWT.ICON_SEARCH); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); gridData.widthHint = FIND_X_WIDTH_HINT; filterText.setLayoutData(gridData); if (fRegex != null) { filterText.setText(fRegex); } Color background = filterText.getBackground(); filterText.addModifyListener(e -> { fRegex = filterText.getText(); filterText.setBackground(background); fView.restartZoomThread(); }); filterText.addKeyListener(new KeyListener() { @Override public void keyReleased(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { handleEnterPressed(parent, labels, filterText); fView.restartZoomThread(); } } }); return filterText; }
Source:
public MeshPartBuilder begin () { if (building) throw new GdxRuntimeException("Call end() after calling begin()"); building = true; builder.begin(mesh.getVertexAttributes(), GL20.GL_LINES); return builder; }

Target:
public MeshPartBuilder begin () { return begin(GL20.GL_LINES); }
Source:
static public void assertEquals(String message, double expected, double actual, double delta) { if (Double.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, Double.valueOf(expected), Double.valueOf(actual)); } }

Target:
static public void assertEquals(String message, double expected, double actual, double delta) { if (Double.compare(expected, actual) == 0) { return; } if (!(Math.abs(expected - actual) <= delta)) { failNotEquals(message, new Double(expected), new Double(actual)); } }