auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static Option<IndexedGuideGroup> appendNewGroup(final TargetObsComp obsComp, final TelescopePosTableWidget positionTable) { final TargetEnvironment env = obsComp.getTargetEnvironment(); final GuideEnvironment ge = env.getGuideEnvironment(); final GuideGroup primaryGroup = ge.getPrimary(); final ImList<GuideGroup> oldGroups = ge.getOptions(); final int newGroupIdx = oldGroups.size(); final GuideGroup newGroup = GuideGroup.create("Manual Group"); final IndexedGuideGroup igg = new IndexedGuideGroup(newGroupIdx, newGroup); final ImList<GuideGroup> newGroups = oldGroups.append(newGroup); if (!positionTable.confirmGroupChange(primaryGroup, newGroup)) { return None.instance(); } obsComp.setTargetEnvironment(env.setGuideEnvironment(ge.setOptions(newGroups) .setPrimaryIndex(newGroupIdx))); positionTable.selectGroup(igg); return new Some<>(igg); }

Target:
private static Option<Tuple2<TargetEnvironment,IndexedGuideGroup>> appendNewGroup(final TargetObsComp obsComp, final TelescopePosTableWidget positionTable) { final TargetEnvironment env = obsComp.getTargetEnvironment(); final GuideEnvironment ge = env.getGuideEnvironment(); final GuideGroup primaryGroup = ge.getPrimary(); final ImList<GuideGroup> oldGroups = ge.getOptions(); final int newGroupIdx = oldGroups.size(); final GuideGroup newGroup = GuideGroup.create("Manual Group"); final IndexedGuideGroup igg = new IndexedGuideGroup(newGroupIdx, newGroup); final ImList<GuideGroup> newGroups = oldGroups.append(newGroup); final TargetEnvironment newEnv; if (positionTable.confirmGroupChange(primaryGroup, newGroup)) { newEnv = env.setGuideEnvironment(ge.setOptions(newGroups).setPrimaryIndex(newGroupIdx)); return new Some<>(new Pair<>(newEnv, igg)); } else { return None.instance(); } }
Source:
protected void removeAllAnnotations() { for (int i = 0; i < timarkers.size(); i++) { TiMarker timarker = timarkers.get(i); if (timarker.getMarker() != null) { timarker.getMarker().remove(); timarker.release(); } } timarkers.clear(); if (mClusterManager != null) { mClusterManager.clearItems(); mClusterManager.cluster(); } }

Target:
protected void removeAllAnnotations() { for (int i = 0; i < timarkers.size(); i++) { TiMarker timarker = timarkers.get(i); if (timarker.getMarker() != null) { timarker.getMarker().remove(); } timarker.release(); } timarkers.clear(); if (mClusterManager != null) { mClusterManager.clearItems(); mClusterManager.cluster(); } }
Source:
public List<FeedbackSessionAttributes> getFeedbackSessionsForUserInCourse( String courseId, String userEmail) throws EntityDoesNotExistException { if (coursesLogic.isCoursePresent(courseId) == false) { throw new EntityDoesNotExistException( "Trying to get feedback sessions for a course that does not exist."); } List<FeedbackSessionAttributes> sessions = getFeedbackSessionsForCourse(courseId); List<FeedbackSessionAttributes> viewableSessions = new ArrayList<FeedbackSessionAttributes>(); if (!sessions.isEmpty()) { InstructorAttributes instructor = instructorsLogic.getInstructorForEmail(courseId, userEmail); for (FeedbackSessionAttributes session : sessions) { if (isFeedbackSessionViewableTo(session, userEmail, instructor)) { viewableSessions.add(session); } } } return viewableSessions; }

Target:
public List<FeedbackSessionAttributes> getFeedbackSessionsForUserInCourse( String courseId, String userEmail) throws EntityDoesNotExistException { if (coursesLogic.isCoursePresent(courseId) == false) { throw new EntityDoesNotExistException( "Trying to get feedback sessions for a course that does not exist."); } return getFeedbackSessionsForUserInCourseSkipCheck(courseId, userEmail); }
Source:
public void interrupt_on_parsing() throws Exception { final StringReader in = new StringReader("class A {\n"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final ByteArrayOutputStream err = new ByteArrayOutputStream(); Interpreter bsh = new Interpreter(in, new PrintStream(out), new PrintStream(err), false); bsh.setShutdownOnExit(false); bsh.interrupt(); Thread t = new Thread(bsh); t.start(); Thread.sleep(250); String stdout = out.toString(); String stderr = err.toString(); System.out.println(">>" + stdout + "<<\n>>" + stderr + "<<"); assertTrue(stdout.contains("... interrupted ...")); assertTrue(!stderr.contains("Parser Error:")); }

Target:
public void interrupt_on_parsing() throws Exception { final StringReader in = new StringReader("class A {\n"); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final ByteArrayOutputStream err = new ByteArrayOutputStream(); Interpreter bsh = new Interpreter(in, new PrintStream(out), new PrintStream(err), false); bsh.interrupt(); Thread t = new Thread(bsh); t.start(); Thread.sleep(250); String stdout = out.toString(); String stderr = err.toString(); System.out.println(">>" + stdout + "<<\n>>" + stderr + "<<"); assertTrue(stdout.contains("... interrupted ...")); assertTrue(!stderr.contains("Parser Error:")); }
Source:
public Observable<DynamicRealmObject> from(DynamicRealm realm, final DynamicRealmObject object) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<DynamicRealmObject>() { @Override public void call(final Subscriber<? super DynamicRealmObject> subscriber) { final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig); objectRefs.get().acquireReference(object); final RealmChangeListener listener = new RealmChangeListener() { @Override public void onChange() { if (!subscriber.isUnsubscribed()) { subscriber.onNext(object); } } }; object.addChangeListener(listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { object.removeChangeListener(listener); observableRealm.close(); objectRefs.get().acquireReference(object); } })); subscriber.onNext(object); } }); }

Target:
public Observable<DynamicRealmObject> from(DynamicRealm realm, final DynamicRealmObject object) { final RealmConfiguration realmConfig = realm.getConfiguration(); return Observable.create(new Observable.OnSubscribe<DynamicRealmObject>() { @Override public void call(final Subscriber<? super DynamicRealmObject> subscriber) { final DynamicRealm observableRealm = DynamicRealm.getInstance(realmConfig); objectRefs.get().acquireReference(object); final RealmChangeListener listener = new RealmChangeListener() { @Override public void onChange() { if (!subscriber.isUnsubscribed()) { subscriber.onNext(object); } } }; object.addChangeListener(listener); subscriber.add(Subscriptions.create(new Action0() { @Override public void call() { object.removeChangeListener(listener); observableRealm.close(); objectRefs.get().releaseReference(object); } })); subscriber.onNext(object); } }); }
Source:
private void removePublishCache(String tenantId, String triggerId, Set<String> dataIds) { if (!isEmpty(dataIds)) { dataIds.stream().forEach(dataId -> { CacheKey cacheKey = new CacheKey(tenantId, dataId); Set<String> triggers = publishCache.get(cacheKey); if (!isEmpty(triggers)) { triggers.remove(triggerId); if (triggers.isEmpty()) { publishCache.remove(cacheKey); } else { publishCache.put(cacheKey, triggers); } } }); } }

Target:
private void removePublishCache(String tenantId, String triggerId, Set<String> dataIds) { if (!isEmpty(dataIds)) { dataIds.stream().forEach(dataId -> { CacheKey cacheKey = new CacheKey(tenantId, dataId); Set<String> triggerIds = publishCache.get(cacheKey); if (!isEmpty(triggerIds)) { triggerIds.remove(triggerId); if (triggerIds.isEmpty()) { publishCache.remove(cacheKey); } else { publishCache.put(cacheKey, triggerIds); } } }); } }
Source:
public void setUp() throws Exception { this.props = new Props(); this.props.put(ConfigurationKeys.AZKABAN_EXECUTOR_MAX_FAILURE_COUNT, 1); this.props.put(ConfigurationKeys.AZKABAN_ADMIN_ALERT_EMAIL, AZ_ADMIN_ALERT_EMAIL); this.loader = mock(ExecutorLoader.class); this.mailAlerter = mock(Alerter.class); this.alerterHolder = mock(AlerterHolder.class); this.apiGateway = mock(ExecutorApiGateway.class); this.executorHealthChecker = new ExecutorHealthChecker(this.props, this.loader, this .apiGateway, this.alerterHolder); this.flow1 = TestUtils.createTestExecutableFlow("exectest1", "exec1"); this.flow1.setExecutionId(EXECUTION_ID_11); this.flow1.setStatus(Status.RUNNING); this.executor1 = new Executor(1, "localhost", 12345, true); when(this.loader.fetchActiveFlows()).thenReturn(this.activeFlows); when(this.alerterHolder.get("email")).thenReturn(this.mailAlerter); }

Target:
public void setUp() throws Exception { this.props = new Props(); this.props.put(ConfigurationKeys.AZKABAN_EXECUTOR_MAX_FAILURE_COUNT, 2); this.props.put(ConfigurationKeys.AZKABAN_ADMIN_ALERT_EMAIL, AZ_ADMIN_ALERT_EMAIL); this.loader = mock(ExecutorLoader.class); this.mailAlerter = mock(Alerter.class); this.alerterHolder = mock(AlerterHolder.class); this.apiGateway = mock(ExecutorApiGateway.class); this.executorHealthChecker = new ExecutorHealthChecker(this.props, this.loader, this .apiGateway, this.alerterHolder); this.flow1 = TestUtils.createTestExecutableFlow("exectest1", "exec1"); this.flow1.setExecutionId(EXECUTION_ID_11); this.flow1.setStatus(Status.RUNNING); this.executor1 = new Executor(1, "localhost", 12345, true); when(this.loader.fetchActiveFlows()).thenReturn(this.activeFlows); when(this.alerterHolder.get("email")).thenReturn(this.mailAlerter); }
Source:
public void queryOneExistedObjectTableUpdate() { User expectedUser = new User(null, "such@email.com"); putUsersBlocking(3); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs(expectedUser.email()) .build()) .prepare() .createObservable(); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(500, MILLISECONDS); testSubscriber.assertValueCount(1); testSubscriber.assertValue(null); testSubscriber.assertNoErrors(); putUserBlocking(expectedUser); testSubscriber.awaitTerminalEvent(500, MILLISECONDS); testSubscriber.assertValueCount(2); testSubscriber.assertValues(null, expectedUser); testSubscriber.assertNoErrors(); }

Target:
public void queryOneExistedObjectTableUpdate() { User expectedUser = new User(null, "such@email.com"); putUsersBlocking(3); final Observable<User> userObservable = storIOSQLite .get() .object(User.class) .withQuery(Query.builder() .table(UserTableMeta.TABLE) .where(UserTableMeta.COLUMN_EMAIL + "=?") .whereArgs(expectedUser.email()) .build()) .prepare() .createObservable() .take(2); TestSubscriber<User> testSubscriber = new TestSubscriber<User>(); userObservable.subscribe(testSubscriber); testSubscriber.awaitTerminalEvent(5, SECONDS); testSubscriber.assertValue(null); testSubscriber.assertNoErrors(); putUserBlocking(expectedUser); testSubscriber.awaitTerminalEvent(5, SECONDS); testSubscriber.assertValues(null, expectedUser); testSubscriber.assertNoErrors(); testSubscriber.unsubscribe(); }
Source:
public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithHeader( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format("/b/%d", bout.number()) ) ), HEADER_ACCEPT, MIME_TEXT_XML ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }

Target:
public void rendersBoutPage() throws Exception { final MkBase base = new MkBase(); final String urn = "urn:test:1"; final User user = base.user(new URN(urn)); user.aliases().add("jeff"); final Alias alias = user.aliases().iterate().iterator().next(); final Bout bout = alias.inbox().bout(alias.inbox().start()); bout.attachments().create("a1"); bout.messages().post("hello, world!"); bout.friends().invite(alias.name()); MatcherAssert.assertThat( XhtmlMatchers.xhtml( new RsPrint( new FkBout(TkIndexTest.REGEX, new TkIndex(base)).route( new RqWithAuth( urn, new RqFake( RqMethod.GET, String.format("/b/%d", bout.number()) ) ) ).get() ).printBody() ), XhtmlMatchers.hasXPaths( "/page/bout[number=1]", "/page/bout[title='untitled']", "/page/bout[unread=0]", "/page/bout/friends/friend[alias='jeff']", "/page/bout/friends/friend/links/link[@rel='photo']", "/page/bout/friends/friend/links/link[@rel='kick']", "/page/bout/attachments/attachment/links/link[@rel='delete']", "/page/bout/messages/message[text='hello, world!']" ) ); }
Source:
private Integer getPrecedenceLevel(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobDeleted: return 0; case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }

Target:
private int getPrecedenceLevel(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobDeleted: return 0; case BlobExpired: return 1; case AmbryUnavailable: return 2; case UnexpectedInternalError: return 3; case OperationTimedOut: return 4; case BlobDoesNotExist: return 5; default: return Integer.MIN_VALUE; } }
Source:
public void doBeforeTest() throws Exception { assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_12); super.doBeforeTest(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); fSession = getGDBLaunch().getSession(); Runnable runnable = new Runnable() { @Override public void run() { fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); Assert.assertTrue(fServicesTracker != null); fCommandControl = fServicesTracker.getService(IGDBControl.class); Assert.assertTrue(fCommandControl != null); fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class); Assert.assertTrue(fMultiRunControl != null); fGdbSync = fServicesTracker.getService(IGDBSynchronizer.class); Assert.assertTrue(fGdbSync != null); IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); Assert.assertTrue(procService != null); fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null); } }; fSession.getExecutor().submit(runnable).get(); }

Target:
public void doBeforeTest() throws Exception { assumeGdbVersionAtLeast(ITestConstants.SUFFIX_GDB_7_12); super.doBeforeTest(); resolveLineTagLocations(SOURCE_NAME, LINE_TAGS); fSession = getGDBLaunch().getSession(); Assert.assertNotNull(fSession); Runnable runnable = new Runnable() { @Override public void run() { fServicesTracker = new DsfServicesTracker(TestsPlugin.getBundleContext(), fSession.getId()); Assert.assertTrue(fServicesTracker != null); fCommandControl = fServicesTracker.getService(IGDBControl.class); Assert.assertTrue(fCommandControl != null); fMultiRunControl = fServicesTracker.getService(IMultiRunControl.class); Assert.assertTrue(fMultiRunControl != null); fGdbSync = fServicesTracker.getService(IGDBSynchronizer.class); Assert.assertTrue(fGdbSync != null); IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class); Assert.assertTrue(procService != null); fSession.addServiceEventListener(ThreadStackFrameSyncTest.this, null); } }; fSession.getExecutor().submit(runnable).get(); }
Source:
public void versionSampleRequest() { HttpRequest request = HttpRequest.builder() .method("POST") .endpoint("<LINK_0>") .addHeader("Host", "iam.amazonaws.com") .payload("Action=CoolVersionWordAction") .build(); request.getPayload().getContentMetadata().setContentType("application/x-www-form-urlencoded; charset=utf-8"); FormSignerV4 filter = new FormSignerV4(apiVersion, accessAndSecretKey, timestamp, serviceAndRegion); HttpRequest filtered = filter.filter(request); assertEquals(filtered.getFirstHeaderOrNull("X-Amz-Date"), timestamp.get()); assertThat(filtered.getPayload().getRawContent().toString().contains("&Version=")); }

Target:
public void versionSampleRequest() { HttpRequest request = HttpRequest.builder() .method("POST") .endpoint("<LINK_0>") .addHeader("Host", "iam.amazonaws.com") .payload("Action=CoolVersionWordAction") .build(); request.getPayload().getContentMetadata().setContentType("application/x-www-form-urlencoded; charset=utf-8"); FormSignerV4 filter = new FormSignerV4(apiVersion, accessAndSecretKey, timestamp, serviceAndRegion); HttpRequest filtered = filter.filter(request); assertEquals(filtered.getFirstHeaderOrNull("X-Amz-Date"), timestamp.get()); assertThat(filtered.getPayload().getRawContent().toString().contains("&Version=2010-05-08")); }
Source:
public PlanNodeStatsEstimate calculateStats(PlanNode node, StatsProvider sourceStats, Lookup lookup, Session session, Map<Symbol, Type> types) { Iterator<Rule<?>> ruleIterator = getCandidates(node).iterator(); while (ruleIterator.hasNext()) { Rule<?> rule = ruleIterator.next(); Optional<PlanNodeStatsEstimate> calculatedStats = calculatedStats(rule, node, sourceStats, lookup, session, types); if (calculatedStats.isPresent()) { return calculatedStats.get(); } } return PlanNodeStatsEstimate.UNKNOWN_STATS; }

Target:
public PlanNodeStatsEstimate calculateStats(PlanNode node, StatsProvider sourceStats, Lookup lookup, Session session, Map<Symbol, Type> types) { Iterator<Rule<?>> ruleIterator = getCandidates(node).iterator(); while (ruleIterator.hasNext()) { Rule<?> rule = ruleIterator.next(); Optional<PlanNodeStatsEstimate> calculatedStats = calculateStats(rule, node, sourceStats, lookup, session, types); if (calculatedStats.isPresent()) { return calculatedStats.get(); } } return PlanNodeStatsEstimate.UNKNOWN_STATS; }
Source:
void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException { final ModelNode address = new ModelNode(); address.add("subsystem", "microprofile-health-smallrye"); ModelNode checkOp = getEmptyOperation(operation, address); System.out.println("checkOp = " + checkOp); ModelNode response = managementClient.getControllerClient().execute(checkOp); System.out.println("response = " + response); final String opOutcome = response.get("outcome").asString(); assertEquals("success", opOutcome); ModelNode result = response.get("result"); assertEquals(mustBeUP? "UP" : "DOWN", result.get("status").asString()); if (probeName != null) { for (ModelNode check : result.get("checks").asList()) { if (probeName.equals(check.get("name").asString())) { assertEquals(mustBeUP? "UP" : "DOWN", check.get("status").asString()); return; } } fail("Probe named " + probeName + " not found in " + result); } }

Target:
void checkGlobalOutcome(ManagementClient managementClient, String operation, boolean mustBeUP, String probeName) throws IOException { final ModelNode address = new ModelNode(); address.add("subsystem", "microprofile-health-smallrye"); ModelNode checkOp = getEmptyOperation(operation, address); ModelNode response = managementClient.getControllerClient().execute(checkOp); final String opOutcome = response.get("outcome").asString(); assertEquals("success", opOutcome); ModelNode result = response.get("result"); assertEquals(mustBeUP? "UP" : "DOWN", result.get("status").asString()); if (probeName != null) { for (ModelNode check : result.get("checks").asList()) { if (probeName.equals(check.get("name").asString())) { assertEquals(mustBeUP? "UP" : "DOWN", check.get("status").asString()); return; } } fail("Probe named " + probeName + " not found in " + result); } }
Source:
public void close() throws IOException { if (reader.ready()) { writeUntilEOF(); } reader.close(); writer.close(); Files.copy(temporaryPath, Paths.get(filePath), StandardCopyOption.REPLACE_EXISTING); temporaryPath.toFile().delete(); }

Target:
public void close() throws IOException { if (reader.ready()) { writeUntilEOF(); } reader.close(); writer.close(); if (!temporaryPath.toFile().renameTo(filePath.toFile())) { throw new IOException("Fixed file could not be renamed. Original path = " + filePath.toAbsolutePath()); } temporaryPath.toFile().delete(); }
Source:
public Builder onlyScaleDown() { onlyScaleDown = true; return this; }

Target:
public Builder onlyScaleDown() { if (targetHeight == 0 && targetWidth == 0) { throw new IllegalStateException("onlyScaleDown can not be applied without resize"); } onlyScaleDown = true; return this; }
Source:
public void visitToken(DetailAST detailAST) { final DetailAST objBlock = detailAST.findFirstToken(TokenTypes.OBJBLOCK); TokenUtil.forEachChild(objBlock, TokenTypes.COMMA, comma -> { final int type = comma.getNextSibling().getType(); if (type != TokenTypes.VARIABLE_DEF && type != TokenTypes.ENUM_CONSTANT_DEF) { log(comma, MSG_KEY); } }); }

Target:
public void visitToken(DetailAST detailAST) { final DetailAST nextSibling = detailAST.getNextSibling(); if (nextSibling.getType() == TokenTypes.COMMA) { final DetailAST nextToNextSibling = nextSibling.getNextSibling(); if (nextToNextSibling.getType() != TokenTypes.ENUM_CONSTANT_DEF) { log(nextSibling, MSG_KEY); } } }
Source:
private void updateTarget(SolGame game) { if (targetPilot == null) { return; } ObjectManager om = game.getObjectManager(); List<SolObject> objs = om.getObjects(); List<FarShip> farShips = om.getFarShips(); if (target != null) { if (objs.contains(target)) { return; } target = null; for (FarShip ship : farShips) { if (ship.getPilot() != targetPilot) { continue; } farTarget = ship; return; } applyAction(Action.MOVE); return; } if (farTarget == null) { throw new AssertionError("Far target " + farTarget + " does not exist!"); } if (om.getFarShips().contains(farTarget)) { return; } farTarget = null; for (SolObject o : objs) { if ((o instanceof SolShip)) { SolShip ship = (SolShip) o; if (ship.getPilot() != targetPilot) { continue; } target = ship; return; } } applyAction(Action.MOVE); }

Target:
private void updateTarget(SolGame game) { if (targetPilot == null) { return; } ObjectManager om = game.getObjectManager(); List<SolObject> objs = om.getObjects(); List<FarShip> farShips = om.getFarShips(); if (target != null) { if (objs.contains(target)) { return; } target = null; for (FarShip ship : farShips) { if (ship.getPilot() != targetPilot) { continue; } farTarget = ship; return; } applyAction(Action.MOVE); return; } if (farTarget == null) { throw new AssertionError("Far target is a null reference!"); } if (om.getFarShips().contains(farTarget)) { return; } farTarget = null; for (SolObject o : objs) { if ((o instanceof SolShip)) { SolShip ship = (SolShip) o; if (ship.getPilot() != targetPilot) { continue; } target = ship; return; } } applyAction(Action.MOVE); }
Source:
public Subcategory getSubcategory() { return subcategories.get(0); }

Target:
public Subcategory getSubcategory() { return subcategories.isEmpty() ? null : subcategories.get(0); }
Source:
public FeedItemFilter(String[] properties) { this.mProperties = properties; Log.d("***xxx***", Arrays.toString(properties)); for (String property : properties) { switch ("" + property) { case "unplayed": showUnplayed = true; break; case "paused": showPaused = true; break; case "not_paused": showNotPaused = true; break; case "played": showPlayed = true; break; case "queued": showQueued = true; break; case "not_queued": showNotQueued = true; break; case "downloaded": showDownloaded = true; break; case "not_downloaded": showNotDownloaded = true; break; case "has_media": showHasMedia = true; break; case "no_media": showNoMedia = true; break; case "is_favorite": showIsFavorite = true; break; case "not_favorite": showNotFavorite = true; break; default: return; } } }

Target:
public FeedItemFilter(String[] properties) { this.mProperties = properties; for (String property : properties) { switch (property) { case "unplayed": showUnplayed = true; break; case "paused": showPaused = true; break; case "not_paused": showNotPaused = true; break; case "played": showPlayed = true; break; case "queued": showQueued = true; break; case "not_queued": showNotQueued = true; break; case "downloaded": showDownloaded = true; break; case "not_downloaded": showNotDownloaded = true; break; case "has_media": showHasMedia = true; break; case "no_media": showNoMedia = true; break; case "is_favorite": showIsFavorite = true; break; case "not_favorite": showNotFavorite = true; break; default: break; } } }
Source:
public MetricDto insert(DbSession session, MetricDto dto) { mapper(session).insert(validate(dto)); return dto; }

Target:
public MetricDto insert(DbSession session, MetricDto dto) { mapper(session).insert(dto); return dto; }
Source:
public AbstractScoreDirector clone() { AbstractScoreDirector clone = (AbstractScoreDirector) scoreDirectorFactory.buildScoreDirector(); setWorkingSolution(workingSolution.cloneSolution()); return clone; }

Target:
public ScoreDirector clone() { ScoreDirector clone = scoreDirectorFactory.buildScoreDirector(); clone.setWorkingSolution(workingSolution.cloneSolution()); return clone; }
Source:
public <T extends Serializable> T computeIfAbsent(String originator, TaskId taskid, String channel, String key, String mappingFunction) throws InvalidChannelException, CompilationException, IOException { T answer; try { Channel<T> chosenChannel = getChannel(channel); answer = chosenChannel.computeIfAbsent(key, (Function<? super String, ? extends T>) evaluateClosure(mappingFunction, Function.class)); commitIfNeeded(channel); logWithContext(taskid, channel, "Run computeIfAbsent" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }

Target:
public Serializable computeIfAbsent(String originator, TaskId taskid, String channel, String key, String mappingFunction) throws InvalidChannelException, CompilationException, IOException { Serializable answer; try { Channel chosenChannel = getChannel(channel); answer = chosenChannel.computeIfAbsent(key, (Function<? super String, ? extends Serializable>) evaluateClosure(mappingFunction, Function.class)); logWithContextAndPersist(taskid, channel, "Run computeIfAbsent" + ON_KEY + QUOTE + key + QUOTE + RESULT_IS + answer, Level.DEBUG); } catch (InvalidChannelException | CompilationException | IOException e) { throw e; } catch (Exception e) { throw new ClosureEvaluationException(EXCEPTION_WHEN_EVALUATING_CLOSURE + StackTraceUtil.getStackTrace(e)); } return answer; }
Source:
void scheduleFullSync(final Project.NameKey project, final String urlMatch) { if (!running) { log.warn("Replication plugin did not finish startup before event"); return; } for (Destination cfg : configs) { for (URIish uri : cfg.getURIs(project, urlMatch)) { cfg.schedule(project, PushOne.ALL_REFS, uri); } } }

Target:
void scheduleFullSync(final Project.NameKey project, final String urlMatch) { if (!running) { log.warn("Replication plugin did not finish startup before event"); return; } for (Destination cfg : configs) { if (cfg.wouldPushProject(project)) { for (URIish uri : cfg.getURIs(project, urlMatch)) { cfg.schedule(project, PushOne.ALL_REFS, uri); } } } }
Source:
protected Node createLocalNode(String nodeName) { Node localNode = null; try { localNode = NodeFactory.createLocalNode(nodeName, false, null, nodeName + "vnname"); if (localNode == null) { logger.error(ExitStatus.RMNODE_NULL.description); System.exit(ExitStatus.RMNODE_NULL.exitCode); } RMNodeStarter.addKeyPairForNode(localNode.getNodeInformation().getURL()); for (Object key : System.getProperties().keySet()) { localNode.setProperty(key.toString(), System.getProperty(key.toString())); } } catch (Throwable t) { logger.error("Unable to create the local node " + nodeName, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return localNode; }

Target:
protected Node createLocalNode(String nodeName) { Node localNode = null; try { localNode = NodeFactory.createLocalNode(nodeName, false, null, nodeName + "vnname"); if (localNode == null) { logger.error(ExitStatus.RMNODE_NULL.description); System.exit(ExitStatus.RMNODE_NULL.exitCode); } for (Object key : System.getProperties().keySet()) { localNode.setProperty(key.toString(), System.getProperty(key.toString())); } } catch (Throwable t) { logger.error("Unable to create the local node " + nodeName, t); System.exit(ExitStatus.RMNODE_ADD_ERROR.exitCode); } return localNode; }
Source:
public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); if (convertView == null) { switch (type) { case SectionRow.ITEM: convertView = mInflater.inflate(R.layout.row_course_outline_list, null); break; case SectionRow.SECTION: convertView = mInflater.inflate(R.layout.row_section_header, null); break; } } final SectionRow row = this.getItem(position); switch (type) { case SectionRow.ITEM: IUnit unit = (IUnit)row.component; ImageView image = (ImageView) convertView.findViewById(R.id.vertical_type); image.setVisibility(View.INVISIBLE); if ( "video".equalsIgnoreCase(unit.getCategory())){ image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_video); } else { image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_html); } image = (ImageView) convertView.findViewById(R.id.bulk_download); image.setVisibility(View.INVISIBLE); if ( "video".equalsIgnoreCase(unit.getCategory())){ image.setVisibility(View.VISIBLE); } TextView view = (TextView) convertView.findViewById(R.id.chapter_name); view.setText(unit.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rowClicked(row); } }); break; case SectionRow.SECTION: IVertical vertical = (IVertical)row.component; ((TextView)convertView).setText(vertical.getName()); break; } return convertView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { int type = getItemViewType(position); if (convertView == null) { switch (type) { case SectionRow.ITEM: convertView = mInflater.inflate(R.layout.row_course_outline_list, null); break; case SectionRow.SECTION: convertView = mInflater.inflate(R.layout.row_section_header, null); break; } } final SectionRow row = this.getItem(position); switch (type) { case SectionRow.ITEM: IUnit unit = (IUnit)row.component; ImageView image = (ImageView) convertView.findViewById(R.id.vertical_type); image.setVisibility(View.INVISIBLE); if ( "video".equals(unit.getCategory())){ image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_video); } else { image.setVisibility(View.VISIBLE); image.setImageResource(R.drawable.unit_html); } image = (ImageView) convertView.findViewById(R.id.bulk_download); image.setVisibility(View.INVISIBLE); if ( "video".equals(unit.getCategory())){ image.setVisibility(View.VISIBLE); } TextView view = (TextView) convertView.findViewById(R.id.chapter_name); view.setText(unit.getName()); convertView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { rowClicked(row); } }); break; case SectionRow.SECTION: IVertical vertical = (IVertical)row.component; ((TextView)convertView).setText(vertical.getName()); break; } return convertView; }
Source:
public Object visit(ASTLocalVariableDeclaration node, Object data) { super.visit(node, data); ASTType type = node.getFirstChildOfType(ASTType.class); if (type != null && type.isTypeInferred()) { ASTVariableInitializer initializer = node.getFirstDescendantOfType(ASTVariableInitializer.class); if (initializer != null && initializer.jjtGetChild(0) instanceof ASTExpression) { ASTExpression expression = (ASTExpression) initializer.jjtGetChild(0); type.setTypeDefinition(expression.getTypeDefinition()); populateVariableDeclaratorFromType(node); } } return data; }

Target:
public Object visit(ASTLocalVariableDeclaration node, Object data) { super.visit(node, data); ASTType type = node.getTypeNode(); if (type == null) { ASTVariableInitializer initializer = node.getFirstDescendantOfType(ASTVariableInitializer.class); if (initializer != null && initializer.jjtGetChild(0) instanceof ASTExpression) { ASTExpression expression = (ASTExpression) initializer.jjtGetChild(0); populateVariableDeclaratorFromType(node, expression.getTypeDefinition()); } } return data; }
Source:
public boolean isRecycleBinSkippingActivated() { Boolean isRecycleBinSkippingActivated = this.configurationSource.getProperty("isRecycleBinSkippingActivated", false); return isRecycleBinSkippingActivated != null && isRecycleBinSkippingActivated; }

Target:
public boolean isRecycleBinSkippingActivated() { return this.configurationSource.getProperty("isRecycleBinSkippingActivated", false); }
Source:
public void clear() { List<String> world_script_events = new ArrayList<String>(); Map<String, dObject> context = new HashMap<String, dObject>(); dPlayer player = null; if (dPlayer.matches(flagOwner)) player = dPlayer.valueOf(flagOwner); dNPC npc = null; if (dNPC.matches(flagOwner)) npc = dNPC.valueOf(flagOwner); String type; if (player != null) { type = "player"; world_script_events.add("player flag cleared"); world_script_events.add("player flag " + flagName + " cleared"); } else if (npc != null) { type = "npc"; world_script_events.add("npc flag cleared"); world_script_events.add("npc flag " + flagName + " cleared"); } else { type = "server"; world_script_events.add("server flag cleared"); world_script_events.add("server flag " + flagName + " cleared"); } context.put("owner", Element.valueOf(flagOwner)); context.put("name", Element.valueOf(flagName)); context.put("type", Element.valueOf(type)); context.put("old_value", value.size() > 1 ? new dList(denizen.getSaves().getStringList(flagPath)) : value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null")); world_script_events.add("flag cleared"); denizen.getSaves().set(flagPath, null); denizen.getSaves().set(flagPath + "-expiration", null); rebuild(); EventManager.doEvents(world_script_events, npc, player != null ? player : null, context, 1); }

Target:
public void clear() { List<String> world_script_events = new ArrayList<String>(); Map<String, dObject> context = new HashMap<String, dObject>(); dPlayer player = null; if (dPlayer.matches(flagOwner)) player = dPlayer.valueOf(flagOwner); dNPC npc = null; if (dNPC.matches(flagOwner)) npc = dNPC.valueOf(flagOwner); String type; if (player != null) { type = "player"; world_script_events.add("player flag cleared"); world_script_events.add("player flag " + flagName + " cleared"); } else if (npc != null) { type = "npc"; world_script_events.add("npc flag cleared"); world_script_events.add("npc flag " + flagName + " cleared"); } else { type = "server"; world_script_events.add("server flag cleared"); world_script_events.add("server flag " + flagName + " cleared"); } context.put("owner", Element.valueOf(flagOwner)); context.put("name", Element.valueOf(flagName)); context.put("type", Element.valueOf(type)); context.put("old_value", value.size() > 1 ? new dList(denizen.getSaves().getStringList(flagPath)) : value.size() == 1 ? new Element(value.get(0).asString()): Element.valueOf("null")); world_script_events.add("flag cleared"); denizen.getSaves().set(flagPath, null); denizen.getSaves().set(flagPath + "-expiration", null); rebuild(); EventManager.doEvents(world_script_events, npc, player, context, 1); }
Source:
public XBee64BitAddress(byte[] address) { this.address = address; }

Target:
public XBee64BitAddress(byte[] address) { if (address == null) throw new NullPointerException("Address cannot be null."); if (address.length > 8) throw new IllegalArgumentException("Address cannot contain more than 8 bytes."); this.address = address; }
Source:
protected void configure() { bind(DevfileSchemaValidator.class); bind(DevfileService.class); DevfileBindings.addComponentProvisioners( binder(), EditorComponentProvisioner.class, PluginProvisioner.class); DevfileBindings.onWorkspaceApplierBinder( binder(), binder -> { binder.addBinding(EDITOR_COMPONENT_TYPE).to(EditorComponentToWorkspaceApplier.class); binder.addBinding(PLUGIN_COMPONENT_TYPE).to(PluginComponentToWorkspaceApplier.class); }); bind(DevfileToWorkspaceConfigConverter.class).to(DevfileConverter.class); DevfileBindings.onComponentIntegrityValidatorBinder( binder(), binder -> { binder.addBinding(PLUGIN_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); binder.addBinding(EDITOR_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); }); }

Target:
protected void configure() { bind(DevfileService.class); DevfileBindings.addComponentProvisioners( binder(), EditorComponentProvisioner.class, PluginProvisioner.class); DevfileBindings.onWorkspaceApplierBinder( binder(), binder -> { binder.addBinding(EDITOR_COMPONENT_TYPE).to(EditorComponentToWorkspaceApplier.class); binder.addBinding(PLUGIN_COMPONENT_TYPE).to(PluginComponentToWorkspaceApplier.class); }); DevfileBindings.onComponentIntegrityValidatorBinder( binder(), binder -> { binder.addBinding(PLUGIN_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); binder.addBinding(EDITOR_COMPONENT_TYPE).to(NoopComponentIntegrityValidator.class); }); }
Source:
public void refresh() { if (tableViewer != null && !tableViewer.getTable().isDisposed()) { List<?> lastRefreshSelection = ((StructuredSelection) tableViewer.getSelection()).toList(); tableViewer.getTable().deselectAll(); tableViewer.setItemCount(contentProvider.getNumberOfElements()); tableViewer.refresh(); if (tableViewer.getTable().getItemCount() > 0) { if (!hasAlreadyBeenRefreshed) { hasAlreadyBeenRefreshed = true; if (!getInitialElementSelections().isEmpty()) { refreshWithLastSelection = true; if (!multi) { lastRefreshSelection = new ArrayList<>(asList(getInitialElementSelections().get(0))); } else { lastRefreshSelection = getInitialElementSelections(); } } } if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) { tableViewer.setSelection(new StructuredSelection(lastRefreshSelection)); } else { refreshWithLastSelection = true; tableViewer.getTable().setSelection(0); tableViewer.getTable().notifyListeners(SWT.Selection, new Event()); } } else { tableViewer.setSelection(StructuredSelection.EMPTY); } } scheduleProgressMessageRefresh(); }

Target:
public void refresh() { if (tableViewer != null && !tableViewer.getTable().isDisposed()) { List<Object> lastRefreshSelection = ((StructuredSelection) tableViewer.getSelection()).toList(); tableViewer.getTable().deselectAll(); tableViewer.setItemCount(contentProvider.getNumberOfElements()); tableViewer.refresh(); if (tableViewer.getTable().getItemCount() > 0) { if (isShownForTheFirstTime) { isShownForTheFirstTime = false; lastRefreshSelection = prepareInitialSelection(lastRefreshSelection); } if (refreshWithLastSelection && lastRefreshSelection != null && lastRefreshSelection.size() > 0) { tableViewer.setSelection(new StructuredSelection(lastRefreshSelection)); } else { refreshWithLastSelection = true; tableViewer.getTable().setSelection(0); tableViewer.getTable().notifyListeners(SWT.Selection, new Event()); } } else { tableViewer.setSelection(StructuredSelection.EMPTY); } } scheduleProgressMessageRefresh(); }
Source:
public static synchronized Injector getInjector() { if (injector == null) { throw new RuntimeException("Injector has not been initialized yet"); } return injector; }

Target:
public static synchronized Injector getInjector() { if (injector == null) { injector = Guice.createInjector(new ThucydidesModule()); } return injector; }
Source:
void bindItem(ReadingListPage page) { this.page = page; getView().setItem(page); getView().setTitle(page.title()); getView().setDescription(StringUtils.capitalize(page.description())); getView().setImageUrl(page.thumbUrl()); getView().setSelected(page.selected()); getView().setActionIcon(R.drawable.ic_more_vert_white_24dp); getView().setActionTint(R.attr.material_theme_de_emphasised_color); getView().setActionHint(R.string.abc_action_menu_overflow_description); getView().setSecondaryActionIcon(page.saving() ? R.drawable.ic_download_in_progress : R.drawable.ic_download_circle_gray_24dp, !page.offline() || page.saving()); getView().setCircularProgressVisibility(page.downloadProgress() > 0 && page.downloadProgress() < MAX_PROGRESS); getView().setProgress(page.downloadProgress() == MAX_PROGRESS ? 0 : page.downloadProgress()); getView().setSecondaryActionHint(R.string.reading_list_article_make_offline); viewsGreyedOutHandler.update((page.offline() && !page.saving()) || DeviceUtil.isOnline(), ReadingListPage.toPageTitle(page), (shouldGreyedOut -> getView().setViewsGreyedOut(shouldGreyedOut))); }

Target:
void bindItem(ReadingListPage page) { this.page = page; getView().setItem(page); getView().setTitle(page.title()); getView().setDescription(StringUtils.capitalize(page.description())); getView().setImageUrl(page.thumbUrl()); getView().setSelected(page.selected()); getView().setActionIcon(R.drawable.ic_more_vert_white_24dp); getView().setActionTint(R.attr.material_theme_de_emphasised_color); getView().setActionHint(R.string.abc_action_menu_overflow_description); getView().setSecondaryActionIcon(page.saving() ? R.drawable.ic_download_in_progress : R.drawable.ic_download_circle_gray_24dp, !page.offline() || page.saving()); getView().setCircularProgressVisibility(page.downloadProgress() > 0 && page.downloadProgress() < MAX_PROGRESS); getView().setProgress(page.downloadProgress() == MAX_PROGRESS ? 0 : page.downloadProgress()); getView().setSecondaryActionHint(R.string.reading_list_article_make_offline); PageExistsInCacheHandler.update((page.offline() && !page.saving()) || DeviceUtil.isOnline(), ReadingListPage.toPageTitle(page), (shouldGreyedOut -> { if (isAdded()) { getView().setViewsGreyedOut(shouldGreyedOut); } })); }
Source:
private void compliant() { int i = 0; while (i < 5) { i++; } for (int j; j < 5;) { j++; } for (int j; j < 5; j++) { } for (;; i++) { } for (;;) { } }

Target:
private void compliant() { int i = 0; for (int j; j < 5;) { j++; } for (int j; j < 5; j++) { } for (;; i++) { } for (;;) { } }
Source:
public void paint(@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) { g.setColor(selected ? SELECTED_BACKGROUND_JB_COLOR : BACKGROUND_JB_COLOR); g.fillRoundRect(targetRegion.x, targetRegion.y + VERTICAL_PADDING, targetRegion.width - RIGHT_MARGIN, targetRegion.height - 2 * VERTICAL_PADDING, 2, 2); FontInfo fontInfo = getFontInfo(inlay.getEditor()); g.setFont(fontInfo.getFont()); g.setColor(INDEX_JB_COLOR); g.drawString(index, targetRegion.x + HORIZONTAL_PADDING, targetRegion.y + fontInfo.fontMetrics().getAscent() + 1); }

Target:
public void paint(@NotNull Inlay inlay, @NotNull Graphics g, @NotNull Rectangle targetRegion, @NotNull TextAttributes textAttributes) { GraphicsUtil.setupRoundedBorderAntialiasing(g); g.setColor(selected ? SELECTED_BACKGROUND_JB_COLOR : BACKGROUND_JB_COLOR); g.fillRoundRect( targetRegion.x + HORIZONTAL_MARGIN, targetRegion.y + VERTICAL_PADDING, targetRegion.width - 2 * HORIZONTAL_MARGIN, targetRegion.height - 2 * VERTICAL_PADDING, ARC_RADIUS, ARC_RADIUS ); FontInfo fontInfo = getFontInfo(inlay.getEditor()); g.setFont(fontInfo.getFont()); g.setColor(selected ? SELECTED_INDEX_JB_COLOR : INDEX_JB_COLOR); g.drawString(index, targetRegion.x + HORIZONTAL_PADDING + HORIZONTAL_MARGIN, targetRegion.y + fontInfo.fontMetrics().getAscent() + 2); }
Source:
private static VmBalloonInfo getBalloonInfo(Map<String, Object> xmlRpcStruct) { Map<String, Object> balloonInfo = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.vm_balloonInfo); VmBalloonInfo vmBalloonInfo = new VmBalloonInfo(); if (balloonInfo != null && balloonInfo.size() > 0) { vmBalloonInfo.setCurrentMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_cur)); vmBalloonInfo.setBalloonMaxMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_max)); vmBalloonInfo.setBalloonTargetMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_target)); vmBalloonInfo.setBalloonMinMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_min)); } else { vmBalloonInfo.setBalloonDeviceEnabled(false); } return vmBalloonInfo; }

Target:
private static VmBalloonInfo getBalloonInfo(Map<String, Object> xmlRpcStruct) { Map<String, Object> balloonInfo = (Map<String, Object>) xmlRpcStruct.get(VdsProperties.vm_balloonInfo); VmBalloonInfo vmBalloonInfo = new VmBalloonInfo(); if (balloonInfo != null && balloonInfo.size() > 0) { vmBalloonInfo.setCurrentMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_cur)); vmBalloonInfo.setBalloonMaxMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_max)); vmBalloonInfo.setBalloonTargetMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_target)); vmBalloonInfo.setBalloonMinMemory(AssignLongValue(balloonInfo, VdsProperties.vm_balloon_min)); if (balloonInfo.size() >= 4) { vmBalloonInfo.setBalloonDeviceEnabled(true); } } else { vmBalloonInfo.setBalloonDeviceEnabled(false); } return vmBalloonInfo; }
Source:
public void notifiedKey(K key) { PrimitiveIterator.OfInt iter = justCompletedSegments; if (iter != null) { iter.forEachRemaining(completeSegment); } justCompletedSegments = null; }

Target:
public void notifiedKey(K key) { PrimitiveIterator.OfInt iter = justCompletedSegments; if (iter != null) { while (iter.hasNext()) { completeSegment(iter.nextInt()); } } justCompletedSegments = null; }
Source:
public void put(String path, URIStatus status) { try { CachedItem item = mCache.get(path, new Callable<CachedItem>() { @Override public CachedItem call() throws Exception { return new CachedItem(); } }); item.setStatus(status); } catch (Exception e) { e.printStackTrace(); } }

Target:
public void put(String path, URIStatus status) { try { CachedItem item = mCache.get(path, () -> new CachedItem()); item.setStatus(status); } catch (ExecutionException e) { LOG.warn("Failed to cache meta data for path {}", path); } }
Source:
public final String getId() { return "main"; }

Target:
public final String getId() { return UNIQUE_DESCRIPTOR_ID; }
Source:
public void testSingleRecord() throws IOException { final String testId = "testSingleRecord"; final int recordCount = 1; final int taskRunInterval = 10; final int deferredWriteDelay = 50; final IMonitoringController controller = this.createController(testId, taskRunInterval, deferredWriteDelay); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } try { controller.terminateMonitoring(); controller.waitForTermination(2000); } catch (InterruptedException e) { Assert.fail(e.getMessage()); } final byte[] data = TestRawDataStorage.getInstance().getData(testId); final ByteBuffer dataBuffer = ByteBuffer.wrap(data); dataBuffer.position(data.length - 4); final int stringTableOffset = dataBuffer.getInt() + 8; dataBuffer.position(stringTableOffset); final int numberOfStrings = VariableLengthEncoding.decodeInt(dataBuffer); Assert.assertEquals(9, numberOfStrings); }

Target:
public void testSingleRecord() throws IOException, InterruptedException { final String testId = "testSingleRecord"; final int recordCount = 1; final int taskRunInterval = 10; final int deferredWriteDelay = 50; final IMonitoringController controller = this.createController(testId, taskRunInterval, deferredWriteDelay); for (int recordIndex = 0; recordIndex < recordCount; recordIndex++) { final OperationExecutionRecord record = new OperationExecutionRecord("op()", "SESS-ID", 0, recordIndex, recordIndex, "host", recordIndex, 1); controller.newMonitoringRecord(record); } controller.terminateMonitoring(); controller.waitForTermination(2000); final byte[] data = TestRawDataStorage.getInstance().getData(testId); final ByteBuffer dataBuffer = ByteBuffer.wrap(data); dataBuffer.position(data.length - 4); final int stringTableOffset = dataBuffer.getInt() + 8; dataBuffer.position(stringTableOffset); final int numberOfStrings = VariableLengthEncoding.decodeInt(dataBuffer); Assert.assertEquals(9, numberOfStrings); }