auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void checkActivatedAdditionalLayers(int expectedNumber) { session = localSession.getOpenedSession(); DAnalysis analysis = (DAnalysis) session.getSessionResource().getContents().get(0); DDiagram dDiagram = (DDiagram) new DViewQuery(analysis.getOwnedViews().get(0)).getLoadedRepresentations().iterator().next(); List<Layer> additionalLayers = Stream.concat(dDiagram.getActivatedLayers().stream(), dDiagram.getActivatedTransientLayers().stream()) .filter(AdditionalLayer.class::isInstance) .collect(Collectors.toList()); assertEquals("There should be " + expectedNumber + " activated additional layers.", expectedNumber, Iterables.size(additionalLayers)); }

Target:
private void checkActivatedAdditionalLayers(int expectedNumber) { session = localSession.getOpenedSession(); DAnalysis analysis = (DAnalysis) session.getSessionResource().getContents().get(0); DDiagram dDiagram = (DDiagram) new DViewQuery(analysis.getOwnedViews().get(0)).getLoadedRepresentations().iterator().next(); long nbAdditionalLayers = Stream.concat(dDiagram.getActivatedLayers().stream(), dDiagram.getActivatedTransientLayers().stream()) .filter(AdditionalLayer.class::isInstance) .count(); assertEquals("There should be " + expectedNumber + " activated additional layers.", expectedNumber, nbAdditionalLayers); }
Source:
public void detectSingleTextLanguage() { DetectedLanguage primaryLanguage = new DetectedLanguage("English", "en", 0.0); List<DetectedLanguage> expectedLanguageList = Collections.singletonList(primaryLanguage); validateDetectedLanguages( Collections.singletonList(client.detectLanguage("This is a test English Text")), expectedLanguageList); }

Target:
public void detectSingleTextLanguage() { validatePrimaryLanguage(new DetectedLanguage("English", "en", 0.0), client.detectLanguage("This is a test English Text")); }
Source:
private void discardTableHint() { if (readIf("INDEX")) { if (readIf(OPEN_PAREN)) { do { readExpression(); } while (readIf(COMMA)); read(CLOSE_PAREN); } else if (readIf(EQUAL)){ readExpression(); } else { throw getSyntaxError(); } } else { readExpression(); } }

Target:
private void discardTableHint() { if (readIf("INDEX")) { if (readIf(OPEN_PAREN)) { do { readExpression(); } while (readIfMore(true)); } else { read(EQUAL); readExpression(); } } else { readExpression(); } }
Source:
private void writeParaText(HwpStreamReader reader, long datasize, StringBuffer buf) throws IOException { int[] chars = reader.uint16((int) (datasize / 2)); for (int index = 0; index < chars.length; index++) { int ch = chars[index]; if (Arrays.binarySearch(HWP_INLINE_CHARS, ch) >= 0) { if (ch == 9) { buf.append('\t'); } index += 7; } else if (Arrays.binarySearch(HWP_EXTENDED_CHARS, ch) >= 0) { index += 7; } else if (Arrays.binarySearch(HWP_CONTROL_CHARS, ch) >= 0) { buf.append(' '); } else { buf.append((char) ch); } } }

Target:
private void writeParaText(HwpStreamReader reader, long datasize, StringBuffer buf) throws IOException { int[] chars = reader.uint16((int) (datasize / 2)); for (int index = 0; index < chars.length; index++) { int ch = chars[index]; if (ch < 32) { if (ch == 9) { buf.append('\t'); index += 7; } else { int type = HWP_CHAR_TYPE[ch]; if (I == type) { index += 7; } else if (X == type) { ENDED index += 7; } else if (C == type) { buf.append(' '); } } } else { buf.append((char) ch); } } }
Source:
public void setArtifactId(String newArtifactId) { LabeledText projectLocationLabeledText = new LabeledText("Artifact id:"); projectLocationLabeledText.setText(newArtifactId); }

Target:
public void setArtifactId(String newArtifactId) { LabeledText artifactIdLabeledText = new LabeledText("Artifact id:"); artifactIdLabeledText.setText(newArtifactId); }
Source:
private void logResponse(RedisResponse response, String extraMessage, Throwable cause) { if (logger.isDebugEnabled() && response != null) { ByteBuf buf = response.encode(new UnpooledByteBufAllocator(false)); if (cause == null) { logger.debug("Redis command returned: - {}", Command.getHexEncodedString(buf.array(), buf.readableBytes()), extraMessage); } else { logger.warn("Redis command FAILED to return: - {}", Command.getHexEncodedString(buf.array(), buf.readableBytes()), extraMessage, cause); } } }

Target:
private void logResponse(RedisResponse response, String extraMessage, Throwable cause) { if (logger.isDebugEnabled() && response != null) { ByteBuf buf = response.encode(new UnpooledByteBufAllocator(false)); if (cause == null) { logger.debug("Redis command returned: - {}", Command.getHexEncodedString(buf.array(), buf.readableBytes()), extraMessage); } else { logger.debug("Redis command FAILED to return: - {}", Command.getHexEncodedString(buf.array(), buf.readableBytes()), extraMessage, cause); } } }
Source:
private List<TimeGraphEntryModel> buildEntryList(@Nullable IProgressMonitor monitor) { List<TimeGraphEntryModel> entryList = new ArrayList<>(); synchronized (fEntryBuilder) { for (Map<String, EntryModelBuilder> rowMap : fEntryBuilder.rowMap().values()) { for (EntryModelBuilder entry : rowMap.values()) { if (monitor != null && monitor.isCanceled()) { return Collections.emptyList(); } entryList.add(entry.build()); } } } return entryList; }

Target:
private List<TimeGraphEntryModel> buildEntryList(@Nullable IProgressMonitor monitor) { List<TimeGraphEntryModel> entryList = new ArrayList<>(); synchronized (fEntryBuilder) { for (EntryModelBuilder entry : fEntryBuilder.values()) { if (monitor != null && monitor.isCanceled()) { return Collections.emptyList(); } entryList.add(entry.build()); } } return entryList; }
Source:
protected void onNewIntent(final Intent intent) { if (intent != null && intent.getAction() != null && intent.getAction().equals("android.intent.action.VIEW")) { bitreserveClient.completeAuthorization(intent.getData(), CLIENT_ID, CLIENT_SECRET, "authorization_code", state).then(new PromiseAction<AuthenticationResponse>() { @Override public void call(AuthenticationResponse authenticationResponse) { Intent intent = new Intent(MainActivity.this, UserActivity.class); intent.putExtra(UserActivity.BUNDLE_EXTRA_BEARER_TOKEN, authenticationResponse.getAccessToken()); startActivity(intent); finish(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } }); } }

Target:
protected void onNewIntent(final Intent intent) { if (intent == null || intent.getAction() == null || !intent.getAction().equals("android.intent.action.VIEW")) { return; } bitreserveClient.completeAuthorization(intent.getData(), CLIENT_ID, CLIENT_SECRET, "authorization_code", state).then(new PromiseAction<AuthenticationResponse>() { @Override public void call(AuthenticationResponse authenticationResponse) { Intent intent = new Intent(MainActivity.this, UserActivity.class); intent.putExtra(UserActivity.BUNDLE_EXTRA_BEARER_TOKEN, authenticationResponse.getAccessToken()); startActivity(intent); finish(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { Toast.makeText(MainActivity.this, e.getMessage(), Toast.LENGTH_LONG).show(); } }); }
Source:
protected IProblemLocation createProblemLocation(ProblemMarkerInfo info) { IProblemLocationFactory factory = CodanRuntime.getInstance().getProblemLocationFactory(); IFile file = (IFile) info.file; return factory.createProblemLocation(file, info.startChar, info.endChar, info.lineNumber); }

Target:
protected IProblemLocation createProblemLocation(ProblemMarkerInfo info) { IProblemLocationFactory factory = CodanRuntime.getInstance().getProblemLocationFactory(); return factory.createProblemLocation( (IFile) info.file, info.startChar, info.endChar, info.lineNumber); }
Source:
public static String getDocumentUrl(DocumentModel doc, String viewId) { NotificationService notificationService = NotificationServiceHelper.getNotificationService(); DocumentViewCodecManager codecService = Framework.getService(DocumentViewCodecManager.class); DocumentViewCodec codec = codecService.getCodec(NOTIFICATION_DOCUMENT_ID_CODEC_NAME); boolean isNotificationCodec = codec != null; String result = ""; if (isNotificationCodec) { if (viewId == null) { viewId = "view_documents"; } DocumentView view = new DocumentViewImpl(doc); view.setViewId(viewId); result = codecService.getUrlFromDocumentView(NOTIFICATION_DOCUMENT_ID_CODEC_NAME, new DocumentViewImpl(doc), true, notificationService.getServerUrlPrefix()); } return result; }

Target:
public static String getDocumentUrl(DocumentModel doc, String viewId) { NotificationService notificationService = NotificationServiceHelper.getNotificationService(); DocumentViewCodecManager codecService = Framework.getService(DocumentViewCodecManager.class); DocumentViewCodec codec = codecService.getCodec(NotificationEventListener.NOTIFICATION_DOCUMENT_ID_CODEC_NAME); boolean isNotificationCodec = codec != null; String result = ""; if (isNotificationCodec) { DocumentView view; if (viewId == null) { view = new DocumentViewImpl(doc); } else { view = new DocumentViewImpl(new DocumentLocationImpl(doc), viewId); } result = codecService.getUrlFromDocumentView(NotificationEventListener.NOTIFICATION_DOCUMENT_ID_CODEC_NAME, view, true, notificationService.getServerUrlPrefix()); } else { log.warn("No codec was found to notify document url. It is like that no UI is installed."); } return result; }
Source:
public DataObjectRemoveNestedClassCommand( DataModelerContext context, String source, DataObject dataObject, DataModelChangeNotifier notifier, JavaClass nestedClass ) { super( context, source, dataObject, notifier ); this.nestedClass = nestedClass; }

Target:
public DataObjectRemoveNestedClassCommand( DataModelerContext context, String source, DataObject dataObject, DataModelChangeNotifier notifier, JavaClass nestedClass ) { super( context, source, dataObject, notifier ); this.nestedClass = PortablePreconditions.checkNotNull( "nestedClass", nestedClass ); }
Source:
public Result apply(ValuesNode valuesNode, Captures captures, Context context) { AtomicBoolean anyRewritten = new AtomicBoolean(); ImmutableList.Builder<List<RowExpression>> rows = ImmutableList.builder(); for (List<RowExpression> row : valuesNode.getRows()) { ImmutableList.Builder<RowExpression> newRow = ImmutableList.builder(); for (RowExpression rowExpression : row) { Consumer<Expression> consumeExpression = expression -> { Expression rewritten = rewriter.rewrite(expression, context); if (!expression.equals(rewritten)) { anyRewritten.set(true); } newRow.add(toRaw(rewritten)); }; if (!ifRaw(rowExpression, consumeExpression)) { newRow.add(rowExpression); } } rows.add(newRow.build()); } if (anyRewritten.get()) { return Result.ofPlanNode(new ValuesNode(valuesNode.getId(), valuesNode.getOutputSymbols(), rows.build())); } return Result.empty(); }

Target:
public Result apply(ValuesNode valuesNode, Captures captures, Context context) { boolean anyRewritten = false; ImmutableList.Builder<List<RowExpression>> rows = ImmutableList.builder(); for (List<RowExpression> row : valuesNode.getRows()) { ImmutableList.Builder<RowExpression> newRow = ImmutableList.builder(); for (RowExpression rowExpression : row) { if (isExpression(rowExpression)) { Expression expression = castToExpression(rowExpression); Expression rewritten = rewriter.rewrite(expression, context); newRow.add(castToRowExpression(rewritten)); if (!expression.equals(rewritten)) { anyRewritten = true; } } else { newRow.add(rowExpression); } } rows.add(newRow.build()); } if (anyRewritten) { return Result.ofPlanNode(new ValuesNode(valuesNode.getId(), valuesNode.getOutputSymbols(), rows.build())); } return Result.empty(); }
Source:
public void testActivityStream() throws Exception { TaskTask searchTask = new TaskTask(null, LocalRepositoryConnector.REPOSITORY_URL, "1"); searchTask.setSummary("summary"); searchTask.setTaskKey("1"); TaskTask task1 = new TaskTask(null, LocalRepositoryConnector.REPOSITORY_URL, "2"); task1.setSummary("1: hit"); task1.setTaskKey("2"); task1.setCreationDate(new Date()); TaskTask task2 = new TaskTask(null, LocalRepositoryConnector.REPOSITORY_URL, "3"); task2.setSummary("2: miss"); task2.setTaskKey("3"); task2.setCreationDate(new Date()); IndexReference reference = new IndexReference(); TaskListIndex taskListIndex = reference.index(); taskListIndex.getTaskList().addTask(task1); taskListIndex.getTaskList().addTask(task2); TaskActivityProvider provider = new TaskActivityProvider(); IActivitySession session = new IActivitySession() { public IActivityManager getManger() { return null; } public void fireActivityEvent(ActivityEvent event) { events.add(event); } }; provider.open(session); provider.query(new TaskActivityScope(searchTask), null); ActivityEvent expected = new ActivityEvent(task1.getHandleIdentifier(), task1.getConnectorKind(), task1.getSummary(), task1.getCreationDate(), null); assertEquals(Collections.singletonList(expected), events); reference.dispose(); }

Target:
public void testActivityStream() throws Exception { TaskTask searchTask = new TaskTask(null, LocalRepositoryConnector.REPOSITORY_URL, "1"); searchTask.setSummary("summary"); searchTask.setTaskKey("1"); TaskActivityProvider provider = new TaskActivityProvider(); IActivitySession session = new IActivitySession() { public IActivityManager getManger() { return null; } public void fireActivityEvent(ActivityEvent event) { events.add(event); } }; provider.open(session); provider.query(new TaskActivityScope(searchTask), null); ActivityEvent expected = new ActivityEvent(task1.getHandleIdentifier(), task1.getConnectorKind(), task1.getSummary(), task1.getCreationDate(), null); assertEquals(Collections.singletonList(expected), events); }
Source:
public static JavaInfo parseWinJavaVersion () { if (preferred == null){ List<JavaInfo> javas = JavaFinder.findJavas(); List<JavaInfo> java32 = new ArrayList<JavaInfo>(); List<JavaInfo> java64 = new ArrayList<JavaInfo>(); Logger.logInfo("The FTB Launcher has found the following Java versions installed:"); for (int i = 0; i < javas.size(); i++) { Logger.logInfo(javas.get(i).toString()); if (preferred == null && javas.get(i) != null) preferred = javas.get(i); if (javas.get(i).is64bits) java64.add(javas.get(i)); else java32.add(javas.get(i)); } if (java64.size() > 0) { for (int i = 0; i < java64.size(); i++) { if (!preferred.is64bits || java64.get(i).compareTo(preferred) == 1) preferred = java64.get(i); } for (int i = 0; i < java64.size(); i++) { if (!preferred.is64bits && java32.get(i).compareTo(preferred) == 1) preferred = java32.get(i); } } if (preferred != null) Logger.logInfo("Preferred: " + preferred.toString()); } if(preferred != null){ return preferred; }else{ Logger.logError("No Java versions found!"); return null; } }

Target:
public static JavaInfo parseWinJavaVersion () { if (preferred == null){ List<JavaInfo> javas = JavaFinder.findJavas(); List<JavaInfo> java32 = new ArrayList<JavaInfo>(); List<JavaInfo> java64 = new ArrayList<JavaInfo>(); Logger.logInfo("The FTB Launcher has found the following Java versions installed:"); for (int i = 0; i < javas.size(); i++) { Logger.logInfo(javas.get(i).toString()); if (preferred == null && javas.get(i) != null) preferred = javas.get(i); if (javas.get(i).is64bits) java64.add(javas.get(i)); else java32.add(javas.get(i)); } if (java64.size() > 0) { for (int i = 0; i < java64.size(); i++) { if (!preferred.is64bits || java64.get(i).compareTo(preferred) == 1) preferred = java64.get(i); } for (int i = 0; i < java64.size(); i++) { if (!preferred.is64bits && java32.get(i).compareTo(preferred) == 1) preferred = java32.get(i); } } Logger.logInfo("Preferred: " + String.valueOf(preferred); } if(preferred != null){ return preferred; }else{ Logger.logError("No Java versions found!"); return null; } }
Source:
public void run() { out.println("Listing vert.x applications..."); List<String> cmd = new ArrayList<>(); if (!ExecUtils.isWindows()) { try { cmd.add("sh"); cmd.add("-c"); cmd.add("ps ax | grep \"vertx.id=\""); dumpFoundVertxApplications(cmd); } catch (Exception e) { e.printStackTrace(out); } } else { try { cmd.add("WMIC"); cmd.add("PROCESS"); cmd.add("WHERE"); cmd.add("CommandLine like '%java.exe%'"); cmd.add("GET"); cmd.add("CommandLine"); cmd.add("/VALUE"); dumpFoundVertxApplications(cmd); } catch (Exception e) { e.printStackTrace(out); } } }

Target:
public void run() { out.println("Listing vert.x applications..."); List<String> cmd = new ArrayList<>(); if (!ExecUtils.isWindows()) { try { cmd.add("sh"); cmd.add("-c"); cmd.add("ps ax | grep \"vertx.id=\""); dumpFoundVertxApplications(cmd); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(out); } catch (Exception e) { e.printStackTrace(out); } } else { try { cmd.add("WMIC"); cmd.add("PROCESS"); cmd.add("WHERE"); cmd.add("CommandLine like '%java.exe%'"); cmd.add("GET"); cmd.add("CommandLine"); cmd.add("/VALUE"); dumpFoundVertxApplications(cmd); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(out); } catch (Exception e) { e.printStackTrace(out); } } }
Source:
public void saveSessionBackupFromResult( final BackupResult backupResult ) throws IOException { final byte[] data = backupResult.getData(); if ( data != null ) { final String key = _sessionIdFormat.createBackupKey( _session.getId() ); _memcached.set( key, toMemcachedExpiration(_session.getMemcachedExpirationTimeToSet()), data ); } else { _log.warn( "No data set for backupResultStatus " + backupResult.getStatus() + " for sessionId " + _session.getIdInternal() + ", skipping backup" + " of non-sticky session in secondary memcached." ); } }

Target:
public void saveSessionBackupFromResult( final BackupResult backupResult ) { final byte[] data = backupResult.getData(); if ( data != null ) { final String key = _sessionIdFormat.createBackupKey( _session.getId() ); _memcached.set( key, toMemcachedExpiration(_session.getMemcachedExpirationTimeToSet()), data ); } else { _log.warn( "No data set for backupResultStatus " + backupResult.getStatus() + " for sessionId " + _session.getIdInternal() + ", skipping backup" + " of non-sticky session in secondary memcached." ); } }
Source:
public void testIDs() { String message = "message Message {\n" + " required binary string (UTF8) = 6;\n" + " required int32 i=1;\n" + " required binary s2= 3;\n" + " required binary s3 =4;\n" + "}\n"; MessageType parsed = MessageTypeParser.parseMessageType(message); MessageType expected = Types.buildMessage() .required(BINARY).as(OriginalType.UTF8).id(6).named("string") .required(INT32).id(1).named("i") .required(BINARY).id(3).named("s2") .required(BINARY).id(4).named("s3") .named("Message"); Assert.assertEquals(expected, parsed); MessageType reparsed = MessageTypeParser.parseMessageType(parsed.toString()); Assert.assertEquals(expected, reparsed); }

Target:
public void testIDs() { String message = "message Message {\n" + " required binary string (UTF8) = 6;\n" + " required int32 i=1;\n" + " required binary s2= 3;\n" + " required binary s3 =4;\n" + "}\n"; MessageType parsed = parseMessageType(message); MessageType expected = buildMessage() .required(BINARY).as(OriginalType.UTF8).id(6).named("string") .required(INT32).id(1).named("i") .required(BINARY).id(3).named("s2") .required(BINARY).id(4).named("s3") .named("Message"); assertEquals(expected, parsed); MessageType reparsed = parseMessageType(parsed.toString()); assertEquals(expected, reparsed); }
Source:
public CommandTreeTest() { addSubcommand(new CommandPing()); addSubcommand(new CommandValue()); addSubcommand(new CommandTreeHelp(this)); }

Target:
public CommandTreeTest() { addSubcommand(new CommandPing(this)); addSubcommand(new CommandValue(this)); addSubcommand(new CommandTreeHelp(this)); }
Source:
public void whenAppLaunched_withAnonymousUser_landingScreenIsDisplayed() { { final MainApplication application = MainApplication.instance(); final EdxEnvironment environment = application.getInjector().getInstance(EdxEnvironment.class); new PrefManager(application, PrefManager.Pref.LOGIN).clearAuth(); environment.getSegment().resetIdentifyUser(); environment.getNotificationDelegate().unsubscribeAll(); } { final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); final Intent launchIntent = instrumentation.getTargetContext().getPackageManager() .getLaunchIntentForPackage(instrumentation.getTargetContext().getPackageName()) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); instrumentation.startActivitySync(launchIntent); instrumentation.waitForIdleSync(); } { onView(withId(R.id.edx_logo)).check(matches(isCompletelyDisplayed())); } }

Target:
public void whenAppLaunched_withAnonymousUser_landingScreenIsDisplayed() { { final MainApplication application = MainApplication.instance(); final EdxEnvironment environment = application.getInjector().getInstance(EdxEnvironment.class); new PrefManager(application, PrefManager.Pref.LOGIN).clearAuth(); environment.getSegment().resetIdentifyUser(); } { final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); final Intent launchIntent = instrumentation.getTargetContext().getPackageManager() .getLaunchIntentForPackage(instrumentation.getTargetContext().getPackageName()) .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); instrumentation.startActivitySync(launchIntent); instrumentation.waitForIdleSync(); } { onView(withId(R.id.edx_logo)).check(matches(isCompletelyDisplayed())); } }
Source:
public void shouldResolveZookeeperHostFromCliProperty() { System.setProperty(SERVICE_DISCOVERY_ZK_HOST, ZK_HOST); final TestService testedService = RatelStandaloneFactory.fromZookeeperServer().getServiceProxy( TestService.class, null); then(testedService.hello()).isEqualTo("success"); }

Target:
public void shouldResolveZookeeperHostFromCliProperty() { System.setProperty(SERVICE_DISCOVERY_ZK_HOST, ZK_HOST); final TestService testedService = RatelStandaloneFactory.fromZookeeperServer().getServiceProxy(TestService.class); then(testedService.hello()).isEqualTo("success"); }
Source:
private static int nextPrime(int previousPrime) { final Integer nextPrime = Match .when(2, (i) -> 3) .orElse(() -> Stream.gen(previousPrime + 2, (v) -> v + 2) .filter((i) -> !isEvenlyDiversableByKnownPrimes(previousPrime, i)) .take(1).head()) .apply(previousPrime); return nextPrime; }

Target:
private static int nextPrime(int previousPrime) { return Match .when(2, i -> 3) .orElse(() -> Stream.gen(previousPrime + 2, v -> v + 2) .filter(i -> !isEvenlyDiversableByKnownPrimes(previousPrime, i)) .take(1).head()) .apply(previousPrime); }
Source:
protected List<AppWidgetProviderInfo> getInstalledProvidersForProfile(UserHandle profile) { return new ArrayList<>(installedProvidersForProfile.get(profile)); }

Target:
protected List<AppWidgetProviderInfo> getInstalledProvidersForProfile(UserHandle profile) { return ImmutableList.copyOf(installedProvidersForProfile.get(profile)); }
Source:
public void testToFile() throws MalformedURLException { String filename = "test.txt"; String unixUrl = "file:/program files/eclipse/"; String expectedUnixFolder = "/program files/eclipse"; String expectedUnixFile = expectedUnixFolder + "/" + filename; assertEquals(new File(expectedUnixFolder), EquinoxManipulatorImpl.toFile(new URL(unixUrl))); assertEquals(new File(expectedUnixFile), EquinoxManipulatorImpl.toFile(new URL(unixUrl + filename))); String windowsUrl = "file:/C:/Program Files/eclipse/"; String expectedWindowsFolder = "C:\\Program Files\\eclipse"; String expectedWindowsFile = expectedWindowsFolder + "\\" + filename; assertEquals(new File(expectedWindowsFolder), EquinoxManipulatorImpl.toFile(new URL(windowsUrl))); assertEquals(new File(expectedWindowsFile), EquinoxManipulatorImpl.toFile(new URL(windowsUrl + filename))); String uncUrl = "file://server/share/folder/"; String expectedUncFolder = " String expectedUncFile = expectedUncFolder + "/" + filename; assertEquals(new File(expectedUncFolder), EquinoxManipulatorImpl.toFile(new URL(uncUrl))); assertEquals(new File(expectedUncFile), EquinoxManipulatorImpl.toFile(new URL(uncUrl + filename))); }

Target:
public void testToFile() throws MalformedURLException { String filename = "test.txt"; String unixUrl = "file:/program files/eclipse/"; String expectedUnixFolder = "/program files/eclipse"; String expectedUnixFile = expectedUnixFolder + "/" + filename; assertEquals(new File(expectedUnixFolder), EquinoxManipulatorImpl.toFile(new URL(unixUrl))); assertEquals(new File(expectedUnixFile), EquinoxManipulatorImpl.toFile(new URL(unixUrl + filename))); String windowsUrl = "file:/C:/Program Files/eclipse/"; String expectedWindowsFolder = "C:\\Program Files\\eclipse"; String expectedWindowsFile = expectedWindowsFolder + "\\" + filename; assertEquals(new File(expectedWindowsFolder), EquinoxManipulatorImpl.toFile(new URL(windowsUrl))); assertEquals(new File(expectedWindowsFile), EquinoxManipulatorImpl.toFile(new URL(windowsUrl + filename))); String uncUrl = "file://server/share/folder/"; String expectedUncFolder = " String expectedUncFile = expectedUncFolder + "/" + filename; assertEquals(new File(expectedUncFolder), EquinoxManipulatorImpl.toFile(new URL(uncUrl))); assertEquals(new File(expectedUncFile), EquinoxManipulatorImpl.toFile(new URL(uncUrl + filename))); String notFileUrl = "<LINK_0>"; String expectedOtherFolder = "/path/to/folder"; String expectedOtherFile = expectedOtherFolder + "/" + filename; assertEquals(new File(expectedOtherFolder), EquinoxManipulatorImpl.toFile(new URL(notFileUrl))); assertEquals(new File(expectedOtherFile), EquinoxManipulatorImpl.toFile(new URL(notFileUrl + filename))); }
Source:
public HoeUpgrade() { super(UPGRADE_NAME, "enderio.darksteel.upgrade.hoe", new ItemStack(Items.DIAMOND_HOE), DarkSteelConfig.darkSteelHoeCost.get()); }

Target:
public HoeUpgrade() { super(UPGRADE_NAME, "enderio.darksteel.upgrade.hoe", new ItemStack(Items.DIAMOND_HOE), DarkSteelConfig.darkSteelHoeCost); }
Source:
protected final Object doWork() { final CopyNumberTriStateHiddenMarkovModel model = modelArguments.createModel(); final TargetCollection<Target> targets = targetArguments.readTargetCollection(false); final ReadCountCollection inputCounts = readAndSortCountsByTargetCoordinates(targets); applyZScoreTransformation(inputCounts); checkForMissingTargetsInInputCounts(targets, inputCounts); openOutput(outputFile, model, targets, inputCounts); final Object result = makeCalls(model, targets, inputCounts); closeOutput(outputFile); return result; }

Target:
protected final Object doWork() { final CopyNumberTriStateHiddenMarkovModel model = modelArguments.createModel(); final TargetCollection<Target> targets = targetArguments.readTargetCollection(false); final ReadCountCollection inputCounts = readAndSortCountsByTargetCoordinates(targets); applyZScoreTransformation(inputCounts); checkForMissingTargetsInInputCounts(targets, inputCounts); openOutput(outputFile, model, targets, inputCounts); makeCalls(model, targets, inputCounts); closeOutput(outputFile); return "SUCCESS"; }
Source:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && sourceCard != null) { Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.chooseTarget(Outcome.Detriment, target, source, game)) { if (!target.getTargets().isEmpty()) { int sacrificedForests = target.getTargets().size(); game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedForests + " untapped Forests for " + sourceCard.getLogName()); for (UUID targetId : target.getTargets()) { Permanent targetPermanent = game.getPermanent(targetId); if (targetPermanent != null) { targetPermanent.sacrifice(source.getSourceId(), game); } } game.addEffect(new SetPowerToughnessSourceEffect(sacrificedForests, sacrificedForests, Duration.WhileOnBattlefield, SubLayer.SetPT_7b), source); return true; } } } return false; }

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Card sourceCard = game.getCard(source.getSourceId()); if (controller != null && sourceCard != null) { Target target = new TargetControlledPermanent(0, Integer.MAX_VALUE, filter, true); if (target.canChoose(source.getSourceId(), source.getControllerId(), game) && controller.chooseTarget(Outcome.Detriment, target, source, game)) { if (!target.getTargets().isEmpty()) { int sacrificedForests = target.getTargets().size(); game.informPlayers(controller.getLogName() + " sacrifices " + sacrificedForests + " untapped Forests for " + sourceCard.getLogName()); for (UUID targetId : target.getTargets()) { Permanent targetPermanent = game.getPermanent(targetId); if (targetPermanent != null) { targetPermanent.sacrifice(source.getSourceId(), game); } } game.addEffect(new SetPowerToughnessSourceEffect(sacrificedForests, sacrificedForests, Duration.Custom, SubLayer.SetPT_7b), source); return true; } } } return false; }
Source:
private String convertBytesToString(List<Byte> bytes) { Collections.reverse(bytes); Byte[] byteArray = bytes.toArray(new Byte[bytes.size()]); return new String(ArrayUtils.toPrimitive(byteArray), Charset.forName("UTF-8")); }

Target:
private String convertBytesToString(List<Byte> bytes) { Collections.reverse(bytes); Byte[] byteArray = bytes.toArray(new Byte[bytes.size()]); return new String(ArrayUtils.toPrimitive(byteArray), getCharset()); }
Source:
public void setRegion (Region region) { checkWidget (); if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); long shape_region = (region == null) ? 0 : region.handle; this.region = region; long topHandle = topHandle (); GTK.gtk_widget_shape_combine_region(topHandle, shape_region); if (!OS.isX11()) { double alpha = GTK.gtk_widget_get_opacity(topHandle); if (alpha == 1) alpha = 0.99; GTK.gtk_widget_set_opacity(topHandle, alpha); } }

Target:
public void setRegion (Region region) { checkWidget (); if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); long shape_region = (region == null) ? 0 : region.handle; this.region = region; long topHandle = topHandle (); if (GTK.GTK_VERSION < OS.VERSION(3, 10, 0) || OS.G_OBJECT_TYPE(topHandle) == GTK.GTK_TYPE_WINDOW()) { GTK.gtk_widget_shape_combine_region(topHandle, shape_region); if (!OS.isX11()) { double alpha = GTK.gtk_widget_get_opacity(topHandle); if (alpha == 1) alpha = 0.99; GTK.gtk_widget_set_opacity(topHandle, alpha); } } else { drawRegion = (this.region != null && this.region.handle != 0); if (drawRegion) { cairoCopyRegion(this.region); } else { cairoDisposeRegion(); } GTK.gtk_widget_queue_draw(topHandle()); } }
Source:
private boolean validateStorage() { List<DiskImage> vmDisksList = getDisksListForChecks(); vmDisksList = ImagesHandler.getDisksDummiesForStorageAllocations(vmDisksList); List<DiskImage> allDisks = new ArrayList<>(vmDisksList); List<DiskImage> memoryDisksList = null; if (getParameters().isSaveMemory()) { memoryDisksList = MemoryUtils.createDiskDummies(VmDeviceUtils.getTotalMemorySizeInBytes(getVm()), MemoryUtils.METADATA_SIZE_IN_BYTES); if (Guid.Empty.equals(getStorageDomainIdForVmMemory(memoryDisksList))) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } allDisks.addAll(memoryDisksList); } MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(allDisks); if (!validate(sdValidator.allDomainsExistAndActive()) || !validate(sdValidator.allDomainsWithinThresholds()) || !validateCinder()) { return false; } if (memoryDisksList == null) { return validate(sdValidator.allDomainsHaveSpaceForNewDisks(vmDisksList)); } return validate(sdValidator.allDomainsHaveSpaceForAllDisks(vmDisksList, memoryDisksList)); }

Target:
private boolean validateStorage() { List<DiskImage> vmDisksList = getDisksListForChecks(); vmDisksList = ImagesHandler.getDisksDummiesForStorageAllocations(vmDisksList); List<DiskImage> allDisks = new ArrayList<>(vmDisksList); List<DiskImage> memoryDisksList = null; if (getParameters().isSaveMemory()) { memoryDisksList = MemoryUtils.createDiskDummies(VmUtils.getSnapshotMemorySizeInBytes(getVm()), MemoryUtils.METADATA_SIZE_IN_BYTES); if (Guid.Empty.equals(getStorageDomainIdForVmMemory(memoryDisksList))) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } allDisks.addAll(memoryDisksList); } MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(allDisks); if (!validate(sdValidator.allDomainsExistAndActive()) || !validate(sdValidator.allDomainsWithinThresholds()) || !validateCinder()) { return false; } if (memoryDisksList == null) { return validate(sdValidator.allDomainsHaveSpaceForNewDisks(vmDisksList)); } return validate(sdValidator.allDomainsHaveSpaceForAllDisks(vmDisksList, memoryDisksList)); }
Source:
public OnlineBackupContext fromCommandLineArguments( String[] commandlineArgs ) { try { OnlineBackupRequiredArguments requiredArguments = backupCommandArgumentHandler.establishRequiredArguments( commandlineArgs ); Config config = onlineBackupCommandConfigLoader.loadConfig( requiredArguments.getAdditionalConfig() ); CheckConsistencyConfig checkConsistencyConfig = backupCommandArgumentHandler.establishConfigurationOverride( config ); return new OnlineBackupContext( requiredArguments, config, checkConsistencyConfig ); } catch ( IncorrectUsage | CommandFailed e ) { throw new IllegalArgumentException( "Something went wrong when evaluating input", e ); } }

Target:
public OnlineBackupContext fromCommandLineArguments( String[] commandlineArgs ) { try { OnlineBackupRequiredArguments requiredArguments = backupCommandArgumentHandler.establishRequiredArguments( commandlineArgs ); Config config = onlineBackupCommandConfigLoader.loadConfig( requiredArguments.getAdditionalConfig() ); ConsistencyFlags consistencyFlags = backupCommandArgumentHandler.readFlagsFromArgumentsOrDefaultToConfig( config ); return new OnlineBackupContext( requiredArguments, config, consistencyFlags ); } catch ( IncorrectUsage | CommandFailed e ) { throw new IllegalArgumentException( "Something went wrong when evaluating input", e ); } }
Source:
public static String sanitizeForHtmlTag(String str) { if (str == null) { return null; } return str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"); }

Target:
public static String sanitizeForHtmlTag(String str) { if (str == null) { return null; } return str.replace("<", "&lt;").replace(">", "&gt;"); }
Source:
public void testClear() { PermanentStorageProxy p = new PermanentStorage(); p.writeToFile("double,fancyname,1.23\nboolean,flag,true\nstring,phrase,What time is it?"); p.loadFromDisk(); p.clear(); boolean result = p.getDouble("fancyname") == null; assertEquals("Should get null back when the table is clear!", result, true); }

Target:
public void testClear() { PermanentStorageProxy p = new PermanentStorage(); p.writeToFile("double,fancyname,1.23\nboolean,flag,true\nstring,phrase,What time is it?"); p.loadFromDisk(); assertEquals(p.getDouble("fancyname"), 1.23, .01); p.clear(); boolean result = p.getDouble("fancyname") == null; assertEquals("Should get null back when the table is clear!", result, true); }
Source:
public void fetchesJson() throws Exception { final String object = "object"; final String message = "message"; final References refs = repo().git().references(); final Tags tags = repo().git().tags(); final String objectsha = refs.get("refs/heads/master").json() .getJsonObject(object).getString("sha"); final JsonObject tagger = Json.createObjectBuilder() .add("name", "Scott").add("email", "scott@gmail.com") .add("date", "2013-06-17T14:53:35-07:00").build(); final JsonObject input = Json.createObjectBuilder() .add("tag", "v.0.1").add(message, "initial version") .add(object, objectsha).add("type", "commit") .add("tagger", tagger).build(); final Tag tag = tags.create(input); try { MatcherAssert.assertThat( tag.json().getString(message), Matchers.is("initial version") ); } finally { refs.remove("tags/v.0.1"); } }

Target:
public void fetchesJson() throws Exception { final String object = "object"; final String message = "message"; final String content = "initial version"; final String name = RandomStringUtils.randomAlphabetic(Tv.FIVE); final References refs = repo().git().references(); final String sha = refs.get("refs/heads/master").json() .getJsonObject(object).getString("sha"); final JsonObject tagger = Json.createObjectBuilder() .add("name", "Scott").add("email", "scott@gmail.com") .add("date", "2013-06-17T14:53:35-07:00").build(); final Tag tag = repo().git().tags().create( Json.createObjectBuilder().add("tag", name) .add(message, content) .add(object, sha).add("type", "commit") .add("tagger", tagger).build() ); try { MatcherAssert.assertThat( tag.json().getString(message), Matchers.is(content) ); } finally { refs.remove( new StringBuilder().append("tags/").append(name).toString() ); } }
Source:
private int getClosestIndex(){ double min = Double.MAX_VALUE; int closestIndex = -1; for(int i = Math.max(bestGuess-50,0);i<Math.min(wayPoints.size(),bestGuess+50);i++){ double d = getDistince(pose,wayPoints.get(i)); if(d < min){ min = d; closestIndex = i; } } return closestIndex; }

Target:
private int getClosestIndex(){ double min = Double.MAX_VALUE; int closestIndex = -1; for(int i = Math.max(bestGuess-50,0);i<Math.min(wayPoints.size(),bestGuess+50);i++){ double d = getDistance(pose,wayPoints.get(i)); if(d < min){ min = d; closestIndex = i; } } return closestIndex; }
Source:
public Page getNextPage() { if (isFinished()) { close(); return null; } if (!isPinotDataFetched) { fetchPinotData(); } if (currentDataTable != null) { estimatedMemoryUsageInBytes -= currentDataTable.getEstimatedSizeInBytes(); } if (dataTableList.size() == 0) { close(); return null; } currentDataTable = dataTableList.pop(); PageBuilder pageBuilder = new PageBuilder(columnTypes); pageBuilder.declarePositions(currentDataTable.getDataTable().getNumberOfRows()); for (int columnHandleIdx = 0; columnHandleIdx < columnHandles.size(); columnHandleIdx++) { BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(columnHandleIdx); Type columnType = columnTypes.get(columnHandleIdx); writeBlock(blockBuilder, columnType, pinotColumnNameIndexMap.get(columnHandles.get(columnHandleIdx).getColumnName())); } Page page = pageBuilder.build(); return page; }

Target:
public Page getNextPage() { if (isFinished()) { close(); return null; } if (!isPinotDataFetched) { fetchPinotData(); } if (currentDataTable != null) { estimatedMemoryUsageInBytes -= currentDataTable.getEstimatedSizeInBytes(); } if (dataTableList.size() == 0) { close(); return null; } currentDataTable = dataTableList.pop(); PageBuilder pageBuilder = new PageBuilder(columnTypes); pageBuilder.declarePositions(currentDataTable.getDataTable().getNumberOfRows()); for (int columnHandleIdx = 0; columnHandleIdx < columnHandles.size(); columnHandleIdx++) { BlockBuilder blockBuilder = pageBuilder.getBlockBuilder(columnHandleIdx); Type columnType = columnTypes.get(columnHandleIdx); writeBlock(blockBuilder, columnType, pinotColumnNameIndexMap.get(columnHandles.get(columnHandleIdx).getColumnName())); } return pageBuilder.build(); }
Source:
private boolean abortInCatch(CatchTree catchTree, VisitorState state) { List<? extends StatementTree> statements = catchTree.getBlock().getStatements(); if (statements.isEmpty()) { return false; } StatementTree lastStmt = statements.get(statements.size() - 1); if (lastStmt.getKind() == EXPRESSION_STATEMENT) { ExpressionTree et = ((ExpressionStatementTree) lastStmt).getExpression(); Symbol sym = ASTHelpers.getSymbol(et); if (sym == null || !(sym instanceof MethodSymbol)) { return false; } String methodName = sym.getQualifiedName().toString(); String className = sym.owner.getQualifiedName().toString(); if (methodName.contains("abort") || methodName.contains("shutdown") || (methodName.equals("exit") && className.equals("java.lang.System"))) { return true; } } return false; }

Target:
private boolean abortInCatch(CatchTree catchTree, VisitorState state) { List<? extends StatementTree> statements = catchTree.getBlock().getStatements(); if (statements.isEmpty()) { return false; } StatementTree lastStmt = statements.get(statements.size() - 1); if (lastStmt.getKind() == EXPRESSION_STATEMENT) { ExpressionTree et = ((ExpressionStatementTree) lastStmt).getExpression(); if (ABORT_MATCHER.matches(et, state)) { return true; } } return false; }
Source:
public static String buildJsonAuthorisationDetailsWithoutAddress() { JsonObject authorisationDetails = buildJsonAuthorisationDetailsWithoutAddress( CARD_HOLDER_NAME, CARD_NUMBER, CVC, EXPIRY_DATE, CARD_BRAND, Boolean.TRUE, null); return toJson(authorisationDetails); }

Target:
public static String buildJsonAuthorisationDetailsWithoutAddress() { JsonObject authorisationDetails = buildJsonAuthorisationDetailsWithoutAddress( CARD_HOLDER_NAME, CARD_NUMBER, CVC, EXPIRY_DATE, CARD_BRAND, Boolean.TRUE, PayersCardType.CREDIT); return toJson(authorisationDetails); }
Source:
private <R> R withSyncListeners(boolean hasListeners, boolean expectEventOnNull, K key, V value, Callable<R> callable) { try { if (!hasListeners) { return callable.call(); } CountDownLatch latch = new CountDownLatch(1); notifier.addSyncNotificationLatch(cache, key, value, latch); try { R ret = callable.call(); if ((ret == null) && !expectEventOnNull) { return ret; } boolean wasClosed = latch.await(timeout, TimeUnit.MILLISECONDS); if (!wasClosed) { log.timeoutWaitingEvent(); } return ret; } finally { notifier.removeSyncNotificationLatch(cache, key, value, latch); } } catch (Exception ex) { if (!(ex instanceof CacheEntryListenerException)) { throw new CacheEntryListenerException(ex); } else { throw (CacheEntryListenerException) ex; } } }

Target:
private <R> R withSyncListeners(boolean hasListeners, boolean expectEventOnNull, K key, V value, Callable<R> callable) { try { if (!hasListeners) { return callable.call(); } CountDownLatch latch = new CountDownLatch(1); notifier.addSyncNotificationLatch(cache, key, value, latch); try { R ret = callable.call(); if ((ret == null) && !expectEventOnNull) { return ret; } boolean wasClosed = latch.await(timeout, TimeUnit.MILLISECONDS); if (!wasClosed) { log.timeoutWaitingEvent(); } return ret; } finally { notifier.removeSyncNotificationLatch(cache, key, value, latch); } } catch (CacheEntryListenerException ex) { throw ex; } catch (Exception e) { throw new CacheEntryListenerException(e); } }
Source:
public void testSelectorMatchOneOf() throws Exception { TestCSSEngine engine = new TestCSSEngine(); final Element E = new TestElement("E", engine); engine.setElementProvider(new IElementProvider() { @Override public Element getElement(Object element, CSSEngine engine) { return E; } }); Selector selector = engine.parseSelectors("E[a~='B']").item(0); E.setAttribute("a", "B ABC"); assertTrue(engine.matches(selector, new Object(), null)); E.setAttribute("a", "ABC B"); assertTrue(engine.matches(selector, new Object(), null)); E.setAttribute("a", "ABC"); assertFalse(engine.matches(selector, new Object(), null)); E.setAttribute("a", "B"); assertTrue(engine.matches(selector, new Object(), null)); }

Target:
public void testSelectorMatchOneOf() throws Exception { TestCSSEngine engine = new TestCSSEngine(); engine.setElementProvider(new IElementProvider() { @Override public Element getElement(Object element, CSSEngine engine) { Element e = new TestElement("E", engine); e.setAttribute("a", element.toString()); return e; } }); Selector selector = engine.parseSelectors("E[a~='B']").item(0); assertTrue(engine.matches(selector, "B AB", null)); assertTrue(engine.matches(selector, "BC B", null)); assertFalse(engine.matches(selector, "ABC", null)); assertTrue(engine.matches(selector, "B", null)); }
Source:
public void testQueryByDeploymentTimeAt() { Deployment firstDeployment = repositoryService.createDeploymentQuery().deploymentName(FIRST_DEPLOYMENT_NAME).singleResult(); Deployment secondDeployment = repositoryService.createDeploymentQuery().deploymentName(SECOND_DEPLOYMENT_NAME).singleResult(); Deployment thirdDeployment = repositoryService.createDeploymentQuery().deploymentName(THIRD_DEPLOYMENT_NAME).singleResult(); ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().deployedAt(firstDeployment.getDeploymentTime()); verifyQueryResults(query, 2); query = repositoryService.createProcessDefinitionQuery().deployedAt(secondDeployment.getDeploymentTime()); verifyQueryResults(query, 1); query = repositoryService.createProcessDefinitionQuery().deployedAt(thirdDeployment.getDeploymentTime()); verifyQueryResults(query, 1); }

Target:
public void testQueryByDeploymentTimeAt() throws ParseException { SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy - HH:mm:ss"); Date startTest = formatter.parse(formatter.format(DateUtils.addSeconds(ClockUtil.now(), 5))); ClockUtil.setCurrentTime(startTest); Date timeAtDeploymentOne = ClockUtil.getCurrentTime(); Deployment tempDeploymentOne = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).addClasspathResource(getResourceTwoPath()).deploy(); engineRule.manageDeployment(tempDeploymentOne); Date timeAtDeploymentTwo = DateUtils.addSeconds(timeAtDeploymentOne, 5); ClockUtil.setCurrentTime(timeAtDeploymentTwo); Deployment tempDeploymentTwo = repositoryService.createDeployment() .addClasspathResource(getResourceOnePath()).deploy(); engineRule.manageDeployment(tempDeploymentTwo); Date timeAtDeploymentThree = DateUtils.addSeconds(timeAtDeploymentTwo, 5); ClockUtil.setCurrentTime(timeAtDeploymentThree); Deployment tempDeploymentThree = repositoryService.createDeployment() .addClasspathResource(getResourceThreePath()).deploy(); engineRule.manageDeployment(tempDeploymentThree); List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAt(timeAtDeploymentOne).list(); assertThat(processDefinitions).hasSize(2); assertThatProcessDefinitionsWereDeployedAt(processDefinitions, timeAtDeploymentOne); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAt(timeAtDeploymentTwo).list(); assertThat(processDefinitions).hasSize(1); assertThatProcessDefinitionsWereDeployedAt(processDefinitions, timeAtDeploymentTwo); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAt(timeAtDeploymentThree).list(); assertThat(processDefinitions).hasSize(1); assertThatProcessDefinitionsWereDeployedAt(processDefinitions, timeAtDeploymentThree); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAt(DateUtils.addSeconds(ClockUtil.getCurrentTime(), 5)).list(); assertThat(processDefinitions).hasSize(0); }
Source:
private void registerCallbacks() { view.addCloseOnClickListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int index = MainView.getInstance().indexOfComponent(view); MainView.getInstance().remove(index); view.revalidate(); view.repaint(); MainView.getInstance().setSelectedIndex(0); } }); }

Target:
private void registerCallbacks() { view.addCloseOnClickListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final int index = MainView.getInstance().indexOfComponent(view); MainView.getInstance().remove(index); view.revalidate(); view.repaint(); MainView.getInstance().setSelectedIndex(0); } }); }
Source:
public int hashCode() { return Objects.hash(getCode(), qrcode, getDeviceId()); }

Target:
public int hashCode() { return Objects.hash(getCode(), getQRCode(), getDeviceId()); }
Source:
public void asyncUpdateCacheSimpleCall() throws Exception { final CacheableTest.Foo foo = new CacheableTest.Foo(1L); final String first = foo.asyncGet().toString(); final String second = foo.asyncGet().toString(); MatcherAssert.assertThat(first, Matchers.equalTo(second)); try { TimeUnit.SECONDS.sleep(2); } catch (final InterruptedException ex) { throw new IllegalStateException(ex); } final String thrid = foo.asyncGet().toString(); MatcherAssert.assertThat(first, Matchers.equalTo(thrid)); try { TimeUnit.SECONDS.sleep(2); } catch (final InterruptedException ex) { throw new IllegalStateException(ex); } final String forth = foo.asyncGet().toString(); MatcherAssert.assertThat(first, Matchers.not(Matchers.equalTo(forth))); }

Target:
public void asyncUpdateCacheSimpleCall() throws Exception { final CacheableTest.Foo foo = new CacheableTest.Foo(1L); final String first = foo.asyncGet().toString(); MatcherAssert.assertThat( first, Matchers.equalTo(foo.asyncGet().toString()) ); TimeUnit.SECONDS.sleep(2); MatcherAssert.assertThat( first, Matchers.equalTo(foo.asyncGet().toString()) ); TimeUnit.SECONDS.sleep(2); MatcherAssert.assertThat( first, Matchers.not(Matchers.equalTo(foo.asyncGet().toString())) ); }