auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testApplyTo() { TaskRepository repository = fixture().createRepository(); AbstractRepositoryConnector connector = TasksUiPlugin.getConnector(repository.getConnectorKind()); AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getConnectorUi(repository.getConnectorKind()); EditRepositoryWizard wizard = new EditRepositoryWizard(repository); dialog = new WizardDialog(new Shell(), wizard); dialog.create(); ITaskRepositoryPage page = wizard.getSettingsPage(); org.junit.Assert.assertNull("repository.getCategory() should be null", repository.getCategory()); page.applyTo(repository); org.junit.Assert.assertEquals(TaskRepository.CATEGORY_BUGS, repository.getCategory()); }

Target:
public void testApplyTo() { TaskRepository repository = fixture().createRepository(); EditRepositoryWizard wizard = new EditRepositoryWizard(repository); dialog = new WizardDialog(new Shell(), wizard); dialog.create(); ITaskRepositoryPage page = wizard.getSettingsPage(); org.junit.Assert.assertNull("repository.getCategory() should be null", repository.getCategory()); page.applyTo(repository); org.junit.Assert.assertEquals(TaskRepository.CATEGORY_BUGS, repository.getCategory()); }
Source:
public void perform() throws MassiveException { final Faction faction1 = this.readArg(); final Faction faction2 = this.readArg(msenderFaction); Rel relationBetweenFactions = faction1.getRelationTo(faction2); String relationText = relationBetweenFactions.getColor().toString() + relationBetweenFactions.getDescFactionMany(); if (relationBetweenFactions == Rel.MEMBER && msenderFaction != faction1) relationText = "<silver>the same faction"; msg(faction1.getName(msenderFaction) +"<i> and "+ faction2.getName(msenderFaction) +"<i> are "+ relationText + "<i>."); }

Target:
public void perform() throws MassiveException { final Faction faction1 = this.readArg(); final Faction faction2 = this.readArg(msenderFaction); Rel relationBetweenFactions = faction1.getRelationTo(faction2); String relationText = relationBetweenFactions.getColor().toString() + relationBetweenFactions.getDescFactionMany(); if (relationBetweenFactions == Rel.MEMBER && msenderFaction != faction1) relationText = "<silver>the same faction"; msg( "%s <i>and %s <i>are %s<i>.", faction1.getName(msenderFaction), faction2.getName(msenderFaction), relationText); }
Source:
public void testCookie() throws SQLException, InterruptedException { server.enqueue(new MockResponse() .setResponseCode(307) .addHeader(LOCATION, server.url("/v1/statement")) .addHeader(SET_COOKIE, "a=apple")); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults())); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults())); QueryRunner queryRunner = new QueryRunner( new ClientSession( server.url("/").uri(), "user", "source", ImmutableSet.of(), "clientInfo", "catalog", "schema", "America/Los_Angeles", Locale.ENGLISH, ImmutableMap.of(), ImmutableMap.of(), null, false, new io.airlift.units.Duration(2, MINUTES)), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), false, false); try (Query query = queryRunner.startQuery("first query will introduce a cookie")) { ByteArrayOutputStream out = new ByteArrayOutputStream(); query.renderOutput(new PrintStream(out), CSV, false); String result = new String(out.toByteArray(), UTF_8); } try (Query query = queryRunner.startQuery("first query should carry the cookie")) { ByteArrayOutputStream out = new ByteArrayOutputStream(); query.renderOutput(new PrintStream(out), CSV, false); String result = new String(out.toByteArray(), UTF_8); } assertEquals(server.takeRequest().getHeader("Cookie"), null); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); }

Target:
public void testCookie() throws SQLException, InterruptedException { server.enqueue(new MockResponse() .setResponseCode(307) .addHeader(LOCATION, server.url("/v1/statement")) .addHeader(SET_COOKIE, "a=apple")); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults())); server.enqueue(new MockResponse() .addHeader(CONTENT_TYPE, "application/json") .setBody(createResults())); QueryRunner queryRunner = new QueryRunner( new ClientSession( server.url("/").uri(), "user", "source", ImmutableSet.of(), "clientInfo", "catalog", "schema", "America/Los_Angeles", Locale.ENGLISH, ImmutableMap.of(), ImmutableMap.of(), null, false, new io.airlift.units.Duration(2, MINUTES)), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), false, false); try (Query query = queryRunner.startQuery("first query will introduce a cookie")) { query.renderOutput(new PrintStream(nullOutputStream()), CSV, false); } try (Query query = queryRunner.startQuery("second query should carry the cookie")) { query.renderOutput(new PrintStream(nullOutputStream()), CSV, false); } assertEquals(server.takeRequest().getHeader("Cookie"), null); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); assertEquals(server.takeRequest().getHeader("Cookie"), "a=apple"); }
Source:
void testConnection(boolean loginValid, String url) { this.url.set(url); try { if (isGuest()) { subscription = userRepository.status(url) .compose(applySchedulers()) .subscribe(new LoginSubscriber()); } else if (loginValid) { subscription = userRepository.login(url, username.get(), password.get()) .compose(applySchedulers()) .subscribe(new LoginSubscriber()); } } catch (IllegalArgumentException illArgE) { Log.e(TAG, illArgE.getMessage(), illArgE); loginError.setValue(illArgE); } }

Target:
void testConnection(boolean loginValid, String url) { testedUrl = url; try { if (isGuest()) { subscription = userRepository.status(url) .compose(applySchedulers()) .subscribe(new LoginSubscriber()); } else if (loginValid) { subscription = userRepository.login(url, username.get(), password.get()) .compose(applySchedulers()) .subscribe(new LoginSubscriber()); } } catch (IllegalArgumentException illArgE) { Log.e(TAG, illArgE.getMessage(), illArgE); loginError.setValue(illArgE); } }
Source:
public final PlanNode optimize( PlanNode plan, Session session, Map<Symbol, Type> types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator) { PlanNode result; long duration; try { long start = System.nanoTime(); result = doOptimize(plan, session, types, symbolAllocator, idAllocator); duration = System.nanoTime() - start; } catch (RuntimeException e) { stats.recordFailure(this); throw e; } stats.record(this, duration); return result; }

Target:
public final PlanNode optimize( PlanNode plan, Session session, Map<Symbol, Type> types, SymbolAllocator symbolAllocator, PlanNodeIdAllocator idAllocator) { PlanNode result; long duration; try { long start = System.nanoTime(); result = delegate.optimize(plan, session, types, symbolAllocator, idAllocator); duration = System.nanoTime() - start; } catch (RuntimeException e) { stats.recordFailure(delegate); throw e; } stats.record(delegate, duration); return result; }
Source:
public HdfsNotebookRepo(ZeppelinConfiguration conf) throws IOException { this.conf = conf; String hadoopConfDir = System.getenv("HADOOP_CONF_DIR"); try { rootDir = new Path(conf.getNotebookDir()); hdfsUtils = new HdfsUtils(conf.getNotebookDir(), hadoopConfDir); hdfsUtils.mkdirs(rootDir); } catch (URISyntaxException e) { throw new IOException(e); } }

Target:
public HdfsNotebookRepo(ZeppelinConfiguration conf) throws IOException { this.conf = conf; try { rootDir = removeProtocol(conf.getNotebookDir()); hdfsSite = new HdfsSite(conf); hdfsSite.mkdirs(rootDir); } catch (URISyntaxException e) { throw new IOException(e); } }
Source:
protected Map<Key<?>, ?> getValues(EntityZombie dataHolder) { Map<Key<?>, Object> values = Maps.newHashMap(); net.minecraft.entity.monster.ZombieType nativeType = dataHolder.getZombieType(); ZombieType type = ZombieUtils.typeFromNative(nativeType); values.put(Keys.ZOMBIE_TYPE, type); if(type == ZombieTypes.VILLAGER) { values.put(Keys.VILLAGER_ZOMBIE_PROFESSION, Optional.empty()); return values; } values.put(Keys.VILLAGER_ZOMBIE_PROFESSION, ZombieUtils.profFromNative(nativeType)); return values; }

Target:
protected Map<Key<?>, ?> getValues(EntityZombie dataHolder) { Map<Key<?>, Object> values = Maps.newHashMap(); net.minecraft.entity.monster.ZombieType nativeType = dataHolder.getZombieType(); ZombieType type = EntityUtil.typeFromNative(nativeType); values.put(Keys.ZOMBIE_TYPE, type); if (type != ZombieTypes.VILLAGER) { values.put(Keys.VILLAGER_ZOMBIE_PROFESSION, Optional.empty()); return values; } values.put(Keys.VILLAGER_ZOMBIE_PROFESSION, EntityUtil.profFromNative(nativeType)); return values; }
Source:
private Widget createCodeTransformMenuButton() { if (codeTransform_ == null) { ImageResource icon = ThemeResources.INSTANCE.codeTransform(); ToolbarPopupMenu menu = new ToolbarPopupMenu(); menu.addItem(commands_.codeCompletion().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.goToHelp().createMenuItem(false)); menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false)); menu.addItem(commands_.findUsages().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.extractFunction().createMenuItem(false)); menu.addItem(commands_.extractLocalVariable().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.reflowComment().createMenuItem(false)); menu.addItem(commands_.commentUncomment().createMenuItem(false)); menu.addItem(commands_.insertRoxygenSkeleton().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.reindent().createMenuItem(false)); menu.addItem(commands_.reformatCode().createMenuItem(false)); menu.addItem(commands_.showDiagnosticsActiveDocument().createMenuItem(false)); menu.addItem(commands_.showDiagnosticsProject().createMenuItem(false)); codeTransform_ = new ToolbarButton("", icon, menu); codeTransform_.setTitle("Code Tools"); } return codeTransform_; }

Target:
private Widget createCodeTransformMenuButton() { if (codeTransform_ == null) { ImageResource icon = ThemeResources.INSTANCE.codeTransform(); ToolbarPopupMenu menu = new ToolbarPopupMenu(); menu.addItem(commands_.codeCompletion().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.goToHelp().createMenuItem(false)); menu.addItem(commands_.goToFunctionDefinition().createMenuItem(false)); menu.addItem(commands_.findUsages().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.extractFunction().createMenuItem(false)); menu.addItem(commands_.extractLocalVariable().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.reflowComment().createMenuItem(false)); menu.addItem(commands_.commentUncomment().createMenuItem(false)); menu.addItem(commands_.insertRoxygenSkeleton().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.reindent().createMenuItem(false)); menu.addItem(commands_.reformatCode().createMenuItem(false)); menu.addSeparator(); menu.addItem(commands_.showDiagnosticsActiveDocument().createMenuItem(false)); menu.addItem(commands_.showDiagnosticsProject().createMenuItem(false)); codeTransform_ = new ToolbarButton("", icon, menu); codeTransform_.setTitle("Code Tools"); } return codeTransform_; }
Source:
public void testParsingNormalDate() { String dateString = "\"2014-11-06T20:16:45Z\""; Gson gson = newGson(); Date date = gson.fromJson(dateString, Date.class); assertNotNull(date); }

Target:
public void testParsingNormalDate() { String dateString = "\"2014-11-06T20:16:45Z\""; Gson gson = newGson(); Date date = gson.fromJson(dateString, Date.class); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); calendar.setTime(date); assertEquals(2014, calendar.get(Calendar.YEAR)); assertEquals(Calendar.NOVEMBER, calendar.get(Calendar.MONTH)); assertEquals(6, calendar.get(Calendar.DAY_OF_MONTH)); assertEquals(20, calendar.get(Calendar.HOUR_OF_DAY)); assertEquals(16, calendar.get(Calendar.MINUTE)); assertEquals(45, calendar.get(Calendar.SECOND)); }
Source:
private List<AggregateStateId> fill(StandStorage storage, int count, Supplier<AggregateStateId<ProjectId>> idSupplier) { List<AggregateStateId> ids = new LinkedList<>(); for (int i = 0; i < count; i++) { AggregateStateId genericId = idSupplier.get(); Message state = newState(genericId); EntityRecord record = newRecord(state); storage.write(genericId, record); ids.add(genericId); } return ids; }

Target:
private List<AggregateStateId> fill(StandStorage storage, int count, Supplier<AggregateStateId<ProjectId>> idSupplier) { List<AggregateStateId> ids = new ArrayList<>(count); for (int i = 0; i < count; i++) { AggregateStateId genericId = idSupplier.get(); Message state = newState(genericId); EntityRecord record = newRecord(state); storage.write(genericId, record); ids.add(genericId); } return ids; }
Source:
private void recordInHistory( final ChatReceivedMessage chatReceivedMessage, final ChatterSession session) { CompletableFuture.runAsync( () -> lobbyChatHistoryDao.recordMessage(chatReceivedMessage, session.getApiKeyId()), threadpool) .exceptionally( e -> { log.error("Error recording chat message in database history table", e); return null; }); }

Target:
private void recordInHistory( final ChatReceivedMessage chatReceivedMessage, final ChatterSession session) { CompletableFuture.runAsync( () -> lobbyChatHistoryDao.recordMessage(chatReceivedMessage, session.getApiKeyId())) .exceptionally( e -> { log.error("Error recording chat message in database history table", e); return null; }); }
Source:
private void publishValueToItems(List<String> itemNames, WR3223CommandType wr3223CommandType, Object value) { if (value != null) { State state = null; if (wr3223CommandType.getItemClass() == NumberItem.class) { try { if (logger.isDebugEnabled()) { logger.debug("WR3223Binding.publishValueToItems: publish command with number ", wr3223CommandType.getCommand(), value.toString().trim()); } state = DecimalType.valueOf(value.toString().trim()); } catch (NumberFormatException nfe) { logger.error("Can't set value to item type because it's not a decimal number.", value, wr3223CommandType.getCommand()); } } else if (wr3223CommandType.getItemClass() == SwitchItem.class) { state = parseBooleanValue(value); if (logger.isDebugEnabled()) { logger.debug("WR3223 publish switch item to {}.", wr3223CommandType.getCommand(), state); } } else if (wr3223CommandType.getItemClass() == ContactItem.class) { state = parseBooleanValue(value) == OnOffType.ON ? OpenClosedType.CLOSED : OpenClosedType.OPEN; if (logger.isDebugEnabled()) { logger.debug("WR3223 publish contact item to {}.", wr3223CommandType.getCommand(), state); } } else { logger.error("Can't set value to item type {}.", value, wr3223CommandType.getCommand()); } if (state != null) { for (String itemName : itemNames) { eventPublisher.postUpdate(itemName, state); } } } else { logger.error("Can't set NULL value to item type {}.", wr3223CommandType.getCommand()); } }

Target:
private void publishValueToItems(List<String> itemNames, WR3223CommandType wr3223CommandType, Object value) { if (value == null) { logger.error("Can't set NULL value to item type {}.", wr3223CommandType.getCommand()); return; } State state = null; if (wr3223CommandType.getItemClass() == NumberItem.class) { try { if (logger.isDebugEnabled()) { logger.debug("WR3223Binding.publishValueToItems: publish command with number ", wr3223CommandType.getCommand(), value.toString().trim()); } state = DecimalType.valueOf(value.toString().trim()); } catch (NumberFormatException nfe) { logger.error("Can't set value to item type because it's not a decimal number.", value, wr3223CommandType.getCommand()); } } else if (wr3223CommandType.getItemClass() == SwitchItem.class) { state = parseBooleanValue(value); if (logger.isDebugEnabled()) { logger.debug("WR3223 publish switch item to {}.", wr3223CommandType.getCommand(), state); } } else if (wr3223CommandType.getItemClass() == ContactItem.class) { state = parseBooleanValue(value) == OnOffType.ON ? OpenClosedType.CLOSED : OpenClosedType.OPEN; if (logger.isDebugEnabled()) { logger.debug("WR3223 publish contact item to {}.", wr3223CommandType.getCommand(), state); } } else { logger.error("Can't set value to item type {}.", value, wr3223CommandType.getCommand()); } if (state != null) { for (String itemName : itemNames) { eventPublisher.postUpdate(itemName, state); } } }
Source:
private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == 400 || errorCode == 409) && !android.text.TextUtils.isEmpty(errorBody)) { try { final FormFieldMessageBody body = gson.fromJson(errorBody, FormFieldMessageBody.class); if (body != null && body.size() > 0) { throw new RegistrationException(body); } } catch (JsonSyntaxException ex) { } } throw new HttpResponseStatusException(errorCode); } }

Target:
private void register(Bundle parameters) throws Exception { final Map<String, String> parameterMap = new HashMap<>(); for (String key : parameters.keySet()) { parameterMap.put(key, parameters.getString(key)); } Response<ResponseBody> response = loginService.register(parameterMap).execute(); if (!response.isSuccessful()) { final int errorCode = response.code(); final String errorBody = response.errorBody().string(); if ((errorCode == HttpStatus.BAD_REQUEST || errorCode == HttpStatus.CONFLICT) && !android.text.TextUtils.isEmpty(errorBody)) { try { final FormFieldMessageBody body = gson.fromJson(errorBody, FormFieldMessageBody.class); if (body != null && body.size() > 0) { throw new RegistrationException(body); } } catch (JsonSyntaxException ex) { } } throw new HttpResponseStatusException(errorCode); } }
Source:
private IStatus verifyContent() throws IOException { SignedContentFactory verifierFactory = ServiceHelper.getService(Activator.getContext(), SignedContentFactory.class); SignedContent signedContent; try { signedContent = verifierFactory.getSignedContent(inputFile); } catch (GeneralSecurityException e) { return new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_failedRead + inputFile, e); } catch (ZipException e) { return Status.OK_STATUS; } ArrayList<IStatus> allStatus = new ArrayList<>(0); SignedContentEntry[] entries = signedContent.getSignedEntries(); for (SignedContentEntry entrie : entries) { try { entrie.verify(); } catch (InvalidContentException e) { allStatus.add(new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_invalidContent + entrie.getName(), e)); }catch (OutOfMemoryError e) { allStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerifier_OutOfMemory, e)); break; } } if (allStatus.size() > 0) return new MultiStatus(Activator.ID, IStatus.ERROR, allStatus.toArray(new IStatus[allStatus.size()]), Messages.SignatureVerification_invalidFileContent + inputFile, null); return Status.OK_STATUS; }

Target:
private IStatus verifyContent() throws IOException { SignedContentFactory verifierFactory = ServiceHelper.getService(Activator.getContext(), SignedContentFactory.class); SignedContent signedContent; try { signedContent = verifierFactory.getSignedContent(inputFile); } catch (GeneralSecurityException e) { return new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_failedRead + inputFile, e); } catch (ZipException e) { return Status.OK_STATUS; } ArrayList<IStatus> allStatus = new ArrayList<>(0); SignedContentEntry[] entries = signedContent.getSignedEntries(); for (SignedContentEntry entry : entries) { try { entry.verify(); } catch (InvalidContentException e) { allStatus.add(new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_invalidContent + entry.getName(), e)); }catch (OutOfMemoryError e) { allStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerifier_OutOfMemory, e)); break; } } if (allStatus.size() > 0) return new MultiStatus(Activator.ID, IStatus.ERROR, allStatus.toArray(new IStatus[allStatus.size()]), Messages.SignatureVerification_invalidFileContent + inputFile, null); return Status.OK_STATUS; }
Source:
public List<ReplicaId> getReplicaIdsByState(ReplicaState state, String dcName) { List<ReplicaId> replicas = new ArrayList<>(); replicaIds.forEach(r -> { if (replicaAndState.get(r) == state && (dcName == null || r.getDataNodeId().getDatacenterName().equals(dcName))) { replicas.add(r); } }); return replicas; }

Target:
public List<ReplicaId> getReplicaIdsByState(ReplicaState state, String dcName) { return replicaIds.stream() .filter(r -> replicaAndState.get(r) == state && (dcName == null || r.getDataNodeId() .getDatacenterName() .equals(dcName))) .collect(Collectors.toList()); }
Source:
boolean isMetadataSynced() { MediaSession.QueueItem currItem = null; for (MediaSession.QueueItem item : getQueue()) { if (item.getQueueId() == getActiveQueueID()) { currItem = item; } } if (currItem == null || !queueItemToMetadata(currItem).getDescription() .equals(getMetadata().getDescription())) { if (DEBUG) { Log.d(TAG, "Metadata currently out of sync for Google Play Music"); Log.d(TAG, " └ Current queueItem: " + currItem); Log.d(TAG, " └ Current metadata : " + getMetadata().getDescription()); } return false; } return true; }

Target:
boolean isMetadataSynced() { MediaSession.QueueItem currItem = null; for (MediaSession.QueueItem item : getQueue()) { if (item.getQueueId() == getActiveQueueID()) { currItem = item; break; } } if (currItem == null || !queueItemToMetadata(currItem).getDescription() .equals(getMetadata().getDescription())) { if (DEBUG) { Log.d(TAG, "Metadata currently out of sync for Google Play Music"); Log.d(TAG, " └ Current queueItem: " + currItem); Log.d(TAG, " └ Current metadata : " + getMetadata().getDescription()); } return false; } return true; }
Source:
private void check() { try { final Properties props = new Properties(); final Session session = Session.getInstance(props); final URLName urlName = new URLName( "pop3", this.host, this.port, null, this.user, this.password ); final Store store = session.getStore(urlName); store.connect(); final Folder inbox = store.getFolder("inbox"); inbox.open(Folder.READ_WRITE); final FlagTerm unseen = new FlagTerm( new Flags(Flags.Flag.SEEN), false ); final Message[] messages = inbox.search(unseen); for (final Message each : messages) { this.action.run(each); } inbox.close(true); store.close(); } catch (final NoSuchProviderException ex) { throw new IllegalStateException(ex); } catch (final MessagingException ex) { throw new IllegalStateException(ex); } }

Target:
private void check() throws MessagingException { Store store = null; Folder inbox = null; try { final Properties props = new Properties(); final Session session = Session.getInstance(props); final URLName url = new URLName( "pop3", this.host, this.port, null, this.user, this.password ); store = session.getStore(url); store.connect(); inbox = store.getFolder("inbox"); if (!inbox.exists()) { throw new IllegalStateException("inbox folder not exist!"); } inbox.open(Folder.READ_WRITE); final FlagTerm unseen = new FlagTerm( new Flags(Flags.Flag.SEEN), false ); for (final Message msg : inbox.search(unseen)) { this.action.run(msg); } } catch (final NoSuchProviderException ex) { throw new IllegalStateException(ex); } finally { inbox.close(true); store.close(); } }
Source:
public static List<byte[]> extractFiles(InputStream rawIn, String boundary) { try { int maxLineSize = 1024; InputStream in = new BufferedInputStream(rawIn); String first = readLine(in, maxLineSize); if (!first.substring(2).equals(boundary)) throw new IllegalStateException("Incorrect boundary! " + boundary + " != " + first.substring(2)); byte[] firstHeaders = readUntil("\r\n\r\n".getBytes(), in); byte[] boundaryBytes = ("\r\n--" + boundary).getBytes(); List<byte[]> files = new ArrayList<>(); while (true) { byte[] file = readUntil(boundaryBytes, in); files.add(file); byte[] headers = readUntil("\r\n\r\n".getBytes(), in); if (headers.length == 0 || Arrays.equals(headers, "--".getBytes())) return files; } } catch (IOException e) { throw new RuntimeException(e); } }

Target:
public static List<byte[]> extractFiles(InputStream rawIn, String boundary) { try { int maxLineSize = 1024; InputStream in = new BufferedInputStream(rawIn); String first = readLine(in, maxLineSize); if (!first.substring(2).equals(boundary)) throw new IllegalStateException("Incorrect boundary! " + boundary + " != " + first.substring(2)); byte[] firstHeaders = readUntil(DOUBLE_NEW_LINE, in); byte[] boundaryBytes = ("\r\n--" + boundary).getBytes(); List<byte[]> files = new ArrayList<>(); while (true) { byte[] file = readUntil(boundaryBytes, in); files.add(file); byte[] headers = readUntil(DOUBLE_NEW_LINE, in); if (headers.length == 0 || Arrays.equals(headers, "--".getBytes())) return files; } } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public void testSendFailsIfExceptionThrown() throws MailException, ExecutionException, InterruptedException { _thrown.expectCause(org.hamcrest.CoreMatchers.instanceOf(MailException.class)); _server.stop(); final RenderedReport report = TestBeanFactory.createRenderedReportBuilder().build(); _sender.send( TestBeanFactory.createRecipientBuilder().build(), ImmutableMap.of(new HtmlReportFormat.Builder().build(), report) ).toCompletableFuture().get(); }

Target:
public void testSendFailsIfExceptionThrown() throws MailException, ExecutionException, InterruptedException { _thrown.expectCause(instanceOf(MailException.class)); _server.stop(); final RenderedReport report = TestBeanFactory.createRenderedReportBuilder().build(); _sender.send( TestBeanFactory.createRecipientBuilder().build(), ImmutableMap.of(new HtmlReportFormat.Builder().build(), report) ).toCompletableFuture().get(); }
Source:
private void doRemove(final Object objectToRemove, final PersistTo persistTo, final ReplicateTo replicateTo) { ensureNotIterable(objectToRemove); maybeEmitEvent(new BeforeDeleteEvent<Object>(objectToRemove)); if (objectToRemove instanceof String) { execute(new BucketCallback<Boolean>() { @Override public Boolean doInBucket() throws InterruptedException, ExecutionException { try { RawJsonDocument deletedDoc = client.remove((String) objectToRemove, persistTo, replicateTo, RawJsonDocument.class); return deletedDoc != null; } catch (Exception e) { handleWriteResultError("Delete document failed: " + e.getMessage(), e); return false; } } }); maybeEmitEvent(new AfterDeleteEvent<Object>(objectToRemove)); return; } final CouchbaseDocument converted = new CouchbaseDocument(); converter.write(objectToRemove, converted); execute(new BucketCallback<Boolean>() { @Override public Boolean doInBucket() { try { RawJsonDocument deletedDoc = client.remove((String) objectToRemove, persistTo, replicateTo, RawJsonDocument.class); return deletedDoc != null; } catch (Exception e) { handleWriteResultError("Delete document failed: " + e.getMessage(), e); return false; } } }); maybeEmitEvent(new AfterDeleteEvent<Object>(objectToRemove)); }

Target:
private void doRemove(final Object objectToRemove, final PersistTo persistTo, final ReplicateTo replicateTo) { ensureNotIterable(objectToRemove); maybeEmitEvent(new BeforeDeleteEvent<Object>(objectToRemove)); if (objectToRemove instanceof String) { execute(new BucketCallback<Boolean>() { @Override public Boolean doInBucket() throws InterruptedException, ExecutionException { try { RawJsonDocument deletedDoc = client.remove((String) objectToRemove, persistTo, replicateTo, RawJsonDocument.class); return deletedDoc != null; } catch (Exception e) { handleWriteResultError("Delete document failed: " + e.getMessage(), e); return false; } } }); maybeEmitEvent(new AfterDeleteEvent<Object>(objectToRemove)); return; } final CouchbaseDocument converted = new CouchbaseDocument(); converter.write(objectToRemove, converted); execute(new BucketCallback<Boolean>() { @Override public Boolean doInBucket() { try { RawJsonDocument deletedDoc = client.remove(converted.getId(), persistTo, replicateTo , RawJsonDocument.class); return deletedDoc != null; } catch (Exception e) { handleWriteResultError("Delete document failed: " + e.getMessage(), e); return false; } } }); maybeEmitEvent(new AfterDeleteEvent<Object>(objectToRemove)); }
Source:
public DataFetcherResult(T data, List<GraphQLError> errors) { this.data = data; this.errors = requireNonNull(errors); }

Target:
public DataFetcherResult(T data, List<GraphQLError> errors) { this.data = data; this.errors = unmodifiableList(assertNotNull(errors)); }
Source:
private static String getenv(String name) { String value = System.getenv(name); if (value == null) { logger.warning("Environment variable " + name + " is undefined"); value = "MISSING"; } return value; }

Target:
private static String getenv(String name) { String value = System.getenv(name); if (value == null) { logger.warning("Environment variable " + name + " was not set"); value = "MISSING"; } return value; }
Source:
public static void writeResultsToFile(JsonObject submission) { String resultsFile = jstring(submission, RemoteContext.SUBMISSION_RESULTS_FILE); if(resultsFile == null) return; List<String> lines = new ArrayList<>(); JsonObject results_json = object(submission, RemoteContext.SUBMISSION_RESULTS); if(results_json == null) return; lines.add(results_json.toString()); try{ Files.write(Paths.get(resultsFile), lines); } catch(IOException ioe){ ioe.printStackTrace(); } }

Target:
public static void writeResultsToFile(JsonObject submission) throws IOException { String resultsFile = jstring(submission, RemoteContext.SUBMISSION_RESULTS_FILE); if(resultsFile == null) return; JsonObject results_json = object(submission, RemoteContext.SUBMISSION_RESULTS); if(results_json == null) return; Files.write(Paths.get(resultsFile), results_json.toString().getBytes(StandardCharsets.UTF_8)); }
Source:
private boolean puppetIsInstalled() throws IOException { int exitCode; try { exitCode = ProgramUtils.executeCommand( this.logger, new String[]{"which", "puppet"}, null, null); } catch (InterruptedException e) { exitCode = 1; } return exitCode == 0; }

Target:
private boolean puppetIsInstalled() throws IOException { int exitCode; try { exitCode = ProgramUtils.executeCommand( this.logger, new String[]{"puppet", "-v"}, null, null); } catch (InterruptedException | IOException e) { exitCode = 1; } return exitCode == 0; }
Source:
private synchronized void scheduleRetry() { schedExecutor.schedule(() -> updatePartitionInfo(), retrySleepTime, TimeUnit.MILLISECONDS); retrySleepTime = Math.min(maxSleepTime, (long) (1.5 * retrySleepTime) + (long) (retrySleepTime * Math.random())); }

Target:
private synchronized void scheduleRetry() { schedExecutor.schedule(this::updatePartitionInfo, retrySleepTime, TimeUnit.MILLISECONDS); retrySleepTime = Math.min(maxSleepTime, (long) (1.5 * retrySleepTime) + (long) (retrySleepTime * Math.random())); }
Source:
private void updateCopiedTemplateImages(List<DiskImage> copiedImagesList, List<DiskImage> originaTemplatelmages, Guid storageDomainId) { List<DiskImage> clonedTemplateDiskImages = new ArrayList<>(getImages()); List<Guid> imagesContainedInStorageDomain = getImagesGuidFromStorage(storageDomainId, getStoragePoolId()); int index = 0; for (DiskImage templateDiskImage : clonedTemplateDiskImages) { if (storageDomainId.equals(originaTemplatelmages.get(index).getStorageIds().get(0))) { continue; } if (imagesContainedInStorageDomain.contains(templateDiskImage.getId())) { log.info("Found a copied image of '{}' on Storage Domain id '{}'", templateDiskImage.getId(), storageDomainId); templateDiskImage.getStorageIds().add(storageDomainId); } index++; } }

Target:
private void updateCopiedTemplateImages(List<DiskImage> copiedImagesList, List<DiskImage> originaTemplatelmages, Guid storageDomainId) { List<Guid> imagesContainedInStorageDomain = getImagesGuidFromStorage(storageDomainId, getStoragePoolId()); int index = 0; for (DiskImage templateDiskImage : copiedImagesList) { if (storageDomainId.equals(originaTemplatelmages.get(index).getStorageIds().get(0))) { continue; } if (imagesContainedInStorageDomain.contains(templateDiskImage.getId())) { log.info("Found a copied image of '{}' on Storage Domain id '{}'", templateDiskImage.getId(), storageDomainId); templateDiskImage.getStorageIds().add(storageDomainId); } index++; } }
Source:
public final boolean hasSourceInfo() throws InvalidTokenException { if (!hasSourceInfoBeenRequested) { Class<? extends NNode> nodeClass = getNNodeClass(); hasSourceInfo = HasSourceInfo.class.isAssignableFrom(nodeClass); hasSourceInfoBeenRequested = true; } return hasSourceInfo; }

Target:
public final boolean hasSourceInfo() { if (!hasSourceInfoBeenRequested) { try { hasSourceInfo = HasSourceInfo.class.isAssignableFrom(getNNodeClass()); } catch (InvalidTokenException e) { hasSourceInfo = false; } finally { hasSourceInfoBeenRequested = true; } } return hasSourceInfo; }
Source:
public void testUpdater() { IHttpUtil mockHttp = new MockHttpUtil(); Updater upd = new Updater(); upd = spy(upd); MockSystemClock clock = new MockSystemClock(); long now = System.currentTimeMillis(); clock.setCurrentTime(now); ServiceLocator.getInstance().putService(IHttpUtil.class, mockHttp); ServiceLocator.getInstance().putService(ISystemClock.class, clock); doReturn(false).when(upd).wifiExclusiveAndUnavailable(Mockito.any(Context.class)); assertFalse(upd.checkForUpdates(activity, "")); assertEquals(0, Updater.sLastUpdateCheck); assertFalse(upd.checkForUpdates(activity, null)); assertEquals(0, Updater.sLastUpdateCheck); assertTrue(upd.checkForUpdates(activity, "anything_else")); assertEquals("1.3.0", upd.stripBuildHostName("1.3.0.Victors-MBPr")); assertEquals("1.3.0", upd.stripBuildHostName("1.3.0")); }

Target:
public void testUpdater() { IHttpUtil mockHttp = new MockHttpUtil(); Updater upd = new Updater(); upd = spy(upd); MockSystemClock clock = new MockSystemClock(); long now = System.currentTimeMillis(); clock.setCurrentTime(now); ServiceLocator.getInstance().putService(IHttpUtil.class, mockHttp); ServiceLocator.getInstance().putService(ISystemClock.class, clock); doReturn(false).when(upd).wifiExclusiveAndUnavailable(Mockito.any(Context.class)); assertFalse(upd.checkForUpdates(activity, "")); assertFalse(upd.checkForUpdates(activity, null)); assertTrue(upd.checkForUpdates(activity, "anything_else")); assertEquals("1.3.0", upd.stripBuildHostName("1.3.0.Victors-MBPr")); assertEquals("1.3.0", upd.stripBuildHostName("1.3.0")); }
Source:
public void modelComplete(boolean global) { refresh(); waitCursor(false); }

Target:
public void modelComplete(boolean global) { refreshTree(); waitCursor(false); }
Source:
public ClusterEventMonitor(ClusterStatusMonitor clusterStatusMonitor, String phaseName) { _phaseName = phaseName; _clusterStatusMonitor = clusterStatusMonitor; _duration = new HistogramDynamicMetric("DurationGauge", new Histogram( new SlidingTimeWindowArrayReservoir(HelixUtil .getSystemPropertyAsLong(RESET_INTERVAL_SYSTEM_PROPERTY_KEY, DEFAULT_RESET_INTERVAL_MS), TimeUnit.MILLISECONDS))); _count = new SimpleDynamicMetric("EventCounter", 0l); _maxDuration = new SimpleDynamicMetric("MaxSingleDurationGauge", 0l); _totalDuration = new SimpleDynamicMetric("TotalDurationCounter", 0l); }

Target:
public ClusterEventMonitor(ClusterStatusMonitor clusterStatusMonitor, String phaseName) { _phaseName = phaseName; _clusterStatusMonitor = clusterStatusMonitor; _duration = new HistogramDynamicMetric("DurationGauge", new Histogram( new SlidingTimeWindowArrayReservoir(getResetIntervalInMs(), TimeUnit.MILLISECONDS))); _count = new SimpleDynamicMetric("EventCounter", 0l); _maxDuration = new SimpleDynamicMetric("MaxSingleDurationGauge", 0l); _totalDuration = new SimpleDynamicMetric("TotalDurationCounter", 0l); }
Source:
protected int doWork() { initializeAggregationState(); try { IOUtil.assertFileIsReadable(IOUtil.getPath(INPUT)); if (VCF != null) IOUtil.assertFileIsReadable(IOUtil.getPath(VCF)); IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE); IOUtil.assertFilesAreReadable(INTERVALS); } catch (final IOException e) { log.error(e, "A problem occurred:", e.getMessage()); return 1; } final int returnValue = processData(); if (returnValue == 0) { log.info("Iteration complete, generating metric files"); aggregatorList.forEach(this::writeMetricsFileForAggregator); log.info(String.format("Examined %d loci, Processed %d loci, Skipped %d loci.\n" + "Computation took %d seconds.", nTotalLoci, nProcessedLoci, nSkippedLoci, progressLogger.getElapsedSeconds())); } return returnValue; }

Target:
protected int doWork() { initializeAggregationState(); try { IOUtil.assertFileIsReadable(IOUtil.getPath(INPUT)); if (VCF != null) { IOUtil.assertFileIsReadable(IOUtil.getPath(VCF)); } IOUtil.assertFileIsReadable(REFERENCE_SEQUENCE); IOUtil.assertFilesAreReadable(INTERVALS); } catch (final IOException e) { log.error(e, "A problem occurred:", e.getMessage()); return 1; } final int returnValue = processData(); if (returnValue == 0) { log.info("Iteration complete, generating metric files"); aggregatorList.forEach(this::writeMetricsFileForAggregator); log.info(String.format("Examined %d loci, Processed %d loci, Skipped %d loci.\n" + "Computation took %d seconds.", nTotalLoci, nProcessedLoci, nSkippedLoci, progressLogger.getElapsedSeconds())); } return returnValue; }
Source:
private static Element getDomainsElement(Document document, ISessionInfo session) { Element domainsElement = document.createElement(SessionConfigStrings.CONFIG_ELEMENT_DOMAINS); for (IDomainInfo domain : session.getDomains()) { Element domainElement = document.createElement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN); String domainType = SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL; if (!domain.isKernel()) { domainType = SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST; } addElementContent(document, domainElement, SessionConfigStrings.CONFIG_ELEMENT_TYPE, domainType); String bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_PER_UID; switch (domain.getBufferType()) { case BUFFER_PER_UID: break; case BUFFER_PER_PID: bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_PER_PID; break; case BUFFER_SHARED: bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_GLOBAL; break; case BUFFER_TYPE_UNKNOWN: default: throw new IllegalArgumentException(Messages.SessionConfigXML_UnknownDomainBufferType); } addElementContent(document, domainElement, SessionConfigStrings.CONFIG_ELEMENT_DOMAIN_BUFFER_TYPE, bufferType); domainElement.appendChild(getChannelsElement(document, domain.isKernel(), domain.getChannels())); domainsElement.appendChild(domainElement); } return domainsElement; }

Target:
private static Element getDomainsElement(Document document, ISessionInfo session) { Element domainsElement = document.createElement(SessionConfigStrings.CONFIG_ELEMENT_DOMAINS); for (IDomainInfo domain : session.getDomains()) { Element domainElement = document.createElement(SessionConfigStrings.CONFIG_ELEMENT_DOMAIN); String domainType = domain.isKernel() ? SessionConfigStrings.CONFIG_DOMAIN_TYPE_KERNEL : SessionConfigStrings.CONFIG_DOMAIN_TYPE_UST; addElementContent(document, domainElement, SessionConfigStrings.CONFIG_ELEMENT_TYPE, domainType); String bufferType = null; switch (domain.getBufferType()) { case BUFFER_PER_UID: bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_PER_UID; break; case BUFFER_PER_PID: bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_PER_PID; break; case BUFFER_SHARED: bufferType = SessionConfigStrings.CONFIG_BUFFER_TYPE_GLOBAL; break; case BUFFER_TYPE_UNKNOWN: default: throw new IllegalArgumentException(Messages.SessionConfigXML_UnknownDomainBufferType); } addElementContent(document, domainElement, SessionConfigStrings.CONFIG_ELEMENT_DOMAIN_BUFFER_TYPE, bufferType); domainElement.appendChild(getChannelsElement(document, domain.isKernel(), domain.getChannels())); domainsElement.appendChild(domainElement); } return domainsElement; }
Source:
private void updateComponentCompletely(Component component, User user) { try { prepareComponent(component); } catch (SW360Exception e) { log.warn("Could not prepare component for complete deletion: " + component.getId(), e); return; } componentRepository.update(component); sendMailNotificationsForComponentUpdate(component, user.getEmail()); }

Target:
private void updateComponentCompletely(Component component, User user) throws SW360Exception { prepareComponent(component); Component actual = componentRepository.get(component.getId()); assertNotNull(actual, "Could not find component to update!"); updateComponentInternal(component, actual, user); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof MaxGauge)) { return false; } MaxGauge m = (MaxGauge) obj; return config.equals(m.getConfig()); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof MaxGauge)) { return false; } MaxGauge m = (MaxGauge) obj; return config.equals(m.getConfig()) && getValue(0).equals(m.getValue(0)); }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentSelectedTimeInterpolator = new BounceInterpolator(); firstRunThrough = true; Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_animated_pin_drop); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Mapbox.getInstance(this, getString(R.string.access_token)); setContentView(R.layout.activity_animated_pin_drop); mapView = findViewById(R.id.mapView); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); }
Source:
public IPath saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData(); URI newDataLocURI = null; URI defaultDataLocURI = null; IRemoteFileProxy proxy = null; try { newDataLocURI = new URI(newDataLoc.toPortableString()); defaultDataLocURI = new URI(defaultDataLoc.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI); } catch (URISyntaxException e) { e.printStackTrace(); } catch (CoreException e) { e.printStackTrace(); } IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath()); IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath()); if (canSave(newDataLoc)) { try { defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null); PerfPlugin.getDefault().setPerfProfileData(newDataLoc); try { PerfProfileView view = (PerfProfileView) PlatformUI .getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(PerfPlugin.VIEW_ID); view.setContentDescription(newDataLoc.toOSString()); } catch (PartInitException e) { } return newDataLoc; } catch (CoreException e1) { e1.printStackTrace(); } } return null; }

Target:
public IPath saveData(String filename) { IPath newDataLoc = getNewDataLocation(filename, DATA_EXT); IPath defaultDataLoc = PerfPlugin.getDefault().getPerfProfileData(); URI newDataLocURI = null; URI defaultDataLocURI = null; IRemoteFileProxy proxy = null; try { newDataLocURI = new URI(newDataLoc.toPortableString()); defaultDataLocURI = new URI(defaultDataLoc.toPortableString()); proxy = RemoteProxyManager.getInstance().getFileProxy(newDataLocURI); } catch (URISyntaxException e) { openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment()); } catch (CoreException e) { openErroDialog(Messages.MsgProxyError, Messages.MsgProxyError, newDataLoc.lastSegment()); } IFileStore newDataFileStore = proxy.getResource(newDataLocURI.getPath()); IFileStore defaultDataFileStore = proxy.getResource(defaultDataLocURI.getPath()); if (canSave(newDataLoc)) { try { defaultDataFileStore.copy(newDataFileStore, EFS.OVERWRITE, null); PerfPlugin.getDefault().setPerfProfileData(newDataLoc); try { PerfProfileView view = (PerfProfileView) PlatformUI .getWorkbench().getActiveWorkbenchWindow() .getActivePage().showView(PerfPlugin.VIEW_ID); view.setContentDescription(newDataLoc.toOSString()); } catch (PartInitException e) { } return newDataLoc; } catch (CoreException e1) { openErroDialog(Messages.PerfSaveSession_failure_title, Messages.PerfSaveSession_failure_msg, newDataLoc.lastSegment()); } } return null; }
Source:
protected boolean checkIfElementOnPage(String cssSelector) { driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); try { driver.findElement(By.cssSelector(cssSelector)); } catch (NoSuchElementException ex) { driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); return false; } catch (StaleElementReferenceException ex) { driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); return false; } driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); return true; }

Target:
protected boolean checkIfElementOnPage(String cssSelector) { driver.manage().timeouts().implicitlyWait(1, TimeUnit.SECONDS); boolean isElementOnPage = true; try { driver.findElement(By.cssSelector(cssSelector)); } catch (Exception ex) { isElementOnPage = false; } finally { driver.manage().timeouts().implicitlyWait(timeOut, TimeUnit.SECONDS); } return isElementOnPage; }
Source:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: IntegerStateValue other = (IntegerStateValue) object; result = Integer.compare(this.value, other.value); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); double thisDoubleValue = this.value; result = Double.compare(thisDoubleValue, otherDoubleValue); break; case LONG: long otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }

Target:
public int compareTo(@Nullable ITmfStateValue object) { if (object == null) { return 1; } int result = 0; switch (object.getType()) { case INTEGER: IntegerStateValue other = (IntegerStateValue) object; result = Integer.compare(this.value, other.value); break; case DOUBLE: double otherDoubleValue = ((DoubleStateValue) object).unboxDouble(); result = Double.compare(this.value, otherDoubleValue); break; case LONG: long otherLongValue = ((LongStateValue) object).unboxLong(); result = Long.compare(this.value, otherLongValue); break; case NULL: result = 1; break; case STRING: result = -1; break; default: break; } return result; }
Source:
private static Set<Class<?>> getAllInterfaces(Class<?> clazz) { Set<Class<?>> interfaces = new HashSet<>(); for (Class<?> intf : clazz.getInterfaces()) { if (intf.getInterfaces().length > 0) { interfaces.addAll(getAllInterfaces(intf)); } interfaces.add(intf); } if (clazz.getSuperclass() != null) { interfaces.addAll(getAllInterfaces(clazz.getSuperclass())); } if (clazz.isInterface()) { interfaces.add(clazz); } return interfaces; }

Target:
private static Set<Class<?>> getAllInterfaces(Class<?> clazz) { Set<Class<?>> interfaces = new LinkedHashSet<>(); for (Class<?> intf : clazz.getInterfaces()) { if (intf.getInterfaces().length > 0) { interfaces.addAll(getAllInterfaces(intf)); } interfaces.add(intf); } if (clazz.getSuperclass() != null) { interfaces.addAll(getAllInterfaces(clazz.getSuperclass())); } if (clazz.isInterface()) { interfaces.add(clazz); } return interfaces; }