auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void startRemoteManager() { if ( !remoteConfiguration.isEnabled() ) { logger.info( "Infinispan remote configuration not enabled. Skip." ); return; } ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host( remoteConfiguration.getRemoteServer() ).port( remoteConfiguration.getHotrodPort() ); remoteCacheManager = new RemoteCacheManager( builder.build() ); logger.info( "Infinispan remote cache manager started." ); }

Target:
private void startRemoteManager() { if ( remoteConfiguration == null || !remoteConfiguration.isEnabled() ) { logger.info( "Infinispan remote configuration not enabled. Skip." ); return; } ConfigurationBuilder builder = new ConfigurationBuilder(); builder.addServer().host( remoteConfiguration.getRemoteServer() ).port( remoteConfiguration.getHotrodPort() ); remoteCacheManager = new RemoteCacheManager( builder.build() ); logger.info( "Infinispan remote cache manager started." ); }
Source:
public static void writeFromInputToOutputUnmanaged(InputStream is, OutputStream os) throws IOException { int count; byte[] buffer = new byte[8192]; try { count = is.read(buffer); } catch (IOException e) { throw new StreamsUtil().new InputIOException(e); } while (count != -1) { try { os.write(buffer, 0, count); } catch (IOException e) { throw new StreamsUtil().new OutputIOException(e); } try { count = is.read(buffer); } catch (IOException e) { throw new StreamsUtil().new InputIOException(e); } } }

Target:
public static void writeFromInputToOutputUnmanaged(InputStream is, OutputStream os) throws InputIOException, OutputIOException { int count; byte[] buffer = new byte[8192]; try { count = is.read(buffer); } catch (IOException e) { throw new StreamsUtil().new InputIOException(e); } while (count != -1) { try { os.write(buffer, 0, count); } catch (IOException e) { throw new StreamsUtil().new OutputIOException(e); } try { count = is.read(buffer); } catch (IOException e) { throw new StreamsUtil().new InputIOException(e); } } }
Source:
@Override public String toString() { return "[cache=" + cctx.name() + ", partitions=" + Arrays.toString(parts.get()) + ", topology=" + topVer; }

Target:
@Override public String toString() { return S.toString(null, "cache", cctx.name(), false, "partitions", Arrays.toString(parts.get()), false, "topology", topVer.toString(), false); }
Source:
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(fContent.size()); for (Map.Entry<String, ITmfStateValue> entry : fContent.entrySet()) { out.writeInt(entry.getKey().length()); out.writeBytes(entry.getKey()); final ITmfStateValue value = entry.getValue(); final byte type = getByteFromType(value.getType()); out.writeByte(type); switch (type) { case TYPE_NULL: case TYPE_INTEGER: out.writeInt(value.unboxInt()); break; case TYPE_LONG: out.writeLong(value.unboxLong()); break; case TYPE_STRING: final @NonNull String string = value.unboxStr(); out.writeInt(string.length()); out.writeBytes(string); break; default: throw new IOException("Write object failed : Invalid data"); } } }

Target:
private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(fContent.size()); for (Map.Entry<String, ITmfStateValue> entry : fContent.entrySet()) { out.writeInt(entry.getKey().length()); out.writeBytes(entry.getKey()); final ITmfStateValue value = entry.getValue(); final byte type = getByteFromType(value.getType()); out.writeByte(type); switch (type) { case TYPE_NULL: break; case TYPE_INTEGER: out.writeInt(value.unboxInt()); break; case TYPE_LONG: out.writeLong(value.unboxLong()); break; case TYPE_STRING: final @NonNull String string = value.unboxStr(); out.writeInt(string.length()); out.writeBytes(string); break; default: throw new IOException("Write object failed : Invalid data"); } } }
Source:
public Slice fromObject(HDHTWalEntry entry) { ByteArrayOutputStream bao = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bao); try { dos.writeInt(entry.getType()); entry.writeObject(dos); dos.flush(); } catch (IOException ex) { throw new RuntimeException("Unable to serialize WAL entry"); } return new Slice(bao.toByteArray()); }

Target:
public Slice fromObject(HDHTWalEntry entry) { ByteArrayOutputStream bao = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bao); try { dos.writeInt(entry.getType()); entry.writeObject(dos); dos.flush(); } catch (IOException ex) { throw new RuntimeException("Unable to serialize WAL entry", ex); } return new Slice(bao.toByteArray()); }
Source:
public void testFooterSettingSerialization() throws Exception { FooterSetting setting = new FooterSetting(); setting.setEnable(false); String jsonTwo = mapper.writeValueAsString(setting); System.out.println(jsonTwo); Assert.assertEquals(jsonTwo, "{\"enable\":false}"); }

Target:
public void testFooterSettingSerialization() throws Exception { FooterSetting setting = new FooterSetting(); setting.setEnable(false); String json = mapper.writeValueAsString(setting); System.out.println(json); Assert.assertEquals(json, "{\"enable\":false}"); }
Source:
public void edit(final VolumeModel object) { driver.edit(object); addBricksButton.setCommand(object.getAddBricksCommand()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { VolumeModel model = (VolumeModel) sender; if ("Bricks".equals(((PropertyChangedEventArgs) args).propertyName)) { bricksCountEditor.setText(ConstantsManager.getInstance() .getMessages() .noOfBricksSelected(model.getBricks().getSelectedItems() == null ? 0 : model.getBricks() .getSelectedItems() .size())); } if(((PropertyChangedEventArgs) args).propertyName.equalsIgnoreCase("optimiseForVirtStore")) { virtStoreOptimiseWarningLabel.setVisible(object.getOptimizeForVirtStore().getEntity() && object.getReplicaCount().getEntity() != 3); } } }); }

Target:
public void edit(final VolumeModel object) { driver.edit(object); addBricksButton.setCommand(object.getAddBricksCommand()); object.getPropertyChangedEvent().addListener(new IEventListener() { @Override public void eventRaised(Event ev, Object sender, EventArgs args) { VolumeModel model = (VolumeModel) sender; if ("Bricks".equals(((PropertyChangedEventArgs) args).propertyName)) { bricksCountEditor.setText(ConstantsManager.getInstance() .getMessages() .noOfBricksSelected(model.getBricks().getSelectedItems() == null ? 0 : model.getBricks() .getSelectedItems() .size())); } } }); object.getOptimizeForVirtStore().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<EventArgs> ev, Object sender, EventArgs args) { virtStoreOptimiseWarningLabel.setVisible(object.getOptimizeForVirtStore().getEntity() && object.getReplicaCount().getEntity() != 3); } }); object.getReplicaCount().getEntityChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<EventArgs> ev, Object sender, EventArgs args) { virtStoreOptimiseWarningLabel.setVisible(object.getOptimizeForVirtStore().getEntity() && object.getReplicaCount().getEntity() != 3); } }); }
Source:
void signOut() { Simplenote application = (Simplenote) getActivity().getApplication(); application.getSimperium().deauthorizeUser(); application.getNotesBucket().reset(); application.getTagsBucket().reset(); application.getNotesBucket().stop(); application.getTagsBucket().stop(); AnalyticsTracker.track( AnalyticsTracker.Stat.USER_SIGNED_OUT, AnalyticsTracker.CATEGORY_USER, "preferences_sign_out_button" ); AnalyticsTracker.refreshMetadata(null); getActivity().finish(); }

Target:
private void signOut() { Simplenote application = (Simplenote) getActivity().getApplication(); application.getSimperium().deauthorizeUser(); application.getNotesBucket().reset(); application.getTagsBucket().reset(); application.getNotesBucket().stop(); application.getTagsBucket().stop(); AnalyticsTracker.track( AnalyticsTracker.Stat.USER_SIGNED_OUT, AnalyticsTracker.CATEGORY_USER, "preferences_sign_out_button" ); AnalyticsTracker.refreshMetadata(null); getActivity().finish(); }
Source:
TextAnalyticsPagedFlux<AnalyzeSentimentResult> analyzeSentimentBatch(Iterable<TextDocumentInput> textInputs, TextAnalyticsRequestOptions options) { Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); try { return new TextAnalyticsPagedFlux<>(() -> (continuationToken, pageSize) -> withContext(context -> service.sentimentWithRestResponseAsync( new MultiLanguageBatchInput().setDocuments(Transforms.toMultiLanguageInput(textInputs)), options == null ? null : options.getModelVersion(), options == null ? null : options.isStatisticsShown(), context) .doOnSubscribe(ignoredValue -> logger.info("A batch of text sentiment input - {}", textInputs.toString())) .doOnSuccess(response -> logger.info("A batch of text sentiment output - {}", response)) .doOnError(error -> logger.warning("Failed to analyze text sentiment - {}", error)) .map(this::toTextAnalyticsPagedResponse)) .flux()); } catch (RuntimeException ex) { return new TextAnalyticsPagedFlux<>(() -> (continuationToken, pageSize) -> fluxError(logger, ex)); } }

Target:
TextAnalyticsPagedFlux<AnalyzeSentimentResult> analyzeSentimentBatch(Iterable<TextDocumentInput> textInputs, TextAnalyticsRequestOptions options) { Objects.requireNonNull(textInputs, "'textInputs' cannot be null."); try { return new TextAnalyticsPagedFlux<>(() -> (continuationToken, pageSize) -> withContext(context -> getAnalyzedSentimentResponseInPage(textInputs, options, context)).flux()); } catch (RuntimeException ex) { return new TextAnalyticsPagedFlux<>(() -> (continuationToken, pageSize) -> fluxError(logger, ex)); } }
Source:
public void addAll(OWLOntology ontology) { Set<OWLOntology> ontologies = new HashSet<OWLOntology>(); ontologies.add(ontology); ReferencedEntitySetProvider resp = new ReferencedEntitySetProvider(ontologies); OntologyHelper.getEntities(ontology); for (OWLEntity entity : resp.getEntities()) { add(ontology, entity); } }

Target:
public void addAll(OWLOntology ontology) { Set<OWLOntology> ontologies = new HashSet<>(); ontologies.add(ontology); ontologies.addAll(ontology.getImports()); ReferencedEntitySetProvider resp = new ReferencedEntitySetProvider(ontologies); for (OWLEntity entity : resp.getEntities()) { add(ontology, entity); } }
Source:
public ChatUser createOrGetChatUser(User user) { ChatUser chatUser = getChatUser(user.getNick()); if(chatUser != null){ return chatUser; } else { return ChatUser.fromIrcUser(user); } }

Target:
public ChatUser createOrGetChatUser(User user) { synchronized (chatUsersByName) { String username = user.getNick(); if (!chatUsersByName.containsKey(username)) { ChatPrefs chatPrefs = preferencesService.getPreferences().getChat(); Color color = null; if (chatPrefs.getChatColorMode().equals(CUSTOM) && chatPrefs.getUserToColor().containsKey(username)) { color = chatPrefs.getUserToColor().get(username); } else if (chatPrefs.getChatColorMode().equals(RANDOM)) { color = ColorGeneratorUtil.generateRandomHexColor(); } chatUsersByName.put(username, ChatUser.fromIrcUser(user, color)); } return chatUsersByName.get(username); } }
Source:
private void recoverTimerJobInstance(EjbTimerJob ejbTimerJob, Exception e) { switch (TIMER_RETRY_POLICY) { case RETRY: logger.warn("Execution of time failed. The timer will be retried {}", ejbTimerJob.getTimerJobInstance()); Transaction<TimerJobInstance> operation = (instance) -> { ZonedDateTime nextRetry = ZonedDateTime.now().plus(TIMER_RETRY_INTERVAL, ChronoUnit.MILLIS); EjbTimerJobRetry info = null; if(ejbTimerJob instanceof EjbTimerJobRetry) { info = ((EjbTimerJobRetry) ejbTimerJob).next(); } else { info = new EjbTimerJobRetry(instance); } if (info.getRetry() > TIMER_RETRY_LIMIT) { logger.warn("The timer reached retry limit {}. It won't be retried again", instance, TIMER_RETRY_LIMIT); } TimerConfig config = new TimerConfig(info, true); timerService.createSingleActionTimer(Date.from(nextRetry.toInstant()), config); }; try { transaction(operation, ejbTimerJob.getTimerJobInstance()); } catch (Exception e1) { logger.error("Failed to executed timer recovery {}", e1.getMessage(), e1); } break; case IGNORE: logger.warn("Execution of time failed. The timer won't be retried {}", ejbTimerJob.getTimerJobInstance()); break; case PLATFORM: logger.warn("Execution of time failed. Application server policy applied {}", ejbTimerJob.getTimerJobInstance()); throw new RuntimeException(e); } }

Target:
private void recoverTimerJobInstance(EjbTimerJob ejbTimerJob, Exception e) { if (ejbTimerJob.getTimerJobInstance().getTrigger().hasNextFireTime() != null) { logger.warn("Execution of time failed Interval Trigger failed {}", ejbTimerJob.getTimerJobInstance()); return; } switch (TIMER_RETRY_POLICY) { case RETRY: logger.warn("Execution of time failed. The timer will be retried {}", ejbTimerJob.getTimerJobInstance()); Transaction<TimerJobInstance> operation = (instance) -> { ZonedDateTime nextRetry = ZonedDateTime.now().plus(TIMER_RETRY_INTERVAL, ChronoUnit.MILLIS); EjbTimerJobRetry info = null; if(ejbTimerJob instanceof EjbTimerJobRetry) { info = ((EjbTimerJobRetry) ejbTimerJob).next(); } else { info = new EjbTimerJobRetry(instance); } if (TIMER_RETRY_LIMIT > 0 && info.getRetry() > TIMER_RETRY_LIMIT) { logger.warn("The timer reached retry limit {}. It won't be retried again", instance, TIMER_RETRY_LIMIT); return; } TimerConfig config = new TimerConfig(info, true); timerService.createSingleActionTimer(Date.from(nextRetry.toInstant()), config); }; try { transaction(operation, ejbTimerJob.getTimerJobInstance()); } catch (Exception e1) { logger.error("Failed to executed timer recovery {}", e1.getMessage(), e1); } break; case PLATFORM: logger.warn("Execution of time failed. Application server policy applied {}", ejbTimerJob.getTimerJobInstance()); throw new RuntimeException(e); } }
Source:
public void testWriteAdvHandleWithFixedLedgerId() throws Exception { Map<String, byte[]> customMetadata = new HashMap<>(); customMetadata.put("test", "test".getBytes(StandardCharsets.UTF_8)); try (WriteAdvHandle writer = result(newCreateLedgerOp() .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withDigestType(DigestType.MAC) .withCustomMetadata(customMetadata) .withPassword("password".getBytes(StandardCharsets.UTF_8)) .makeAdv() .withLedgerId(1234) .execute());) { assertEquals(1234, writer.getId()); long entryId = 0; byte[] data = "foo".getBytes(StandardCharsets.UTF_8); writer.write(entryId++, ByteBuffer.wrap(data)).get(); writer.write(entryId++, ByteBuffer.wrap(data)).get(); writer.write(entryId++, Unpooled.wrappedBuffer(data)).get(); try { result(writer.write(entryId - 1, Unpooled.wrappedBuffer(data))); } catch (BKDuplicateEntryIdException ok) { } writer.write(entryId++, ByteBuffer.wrap(data)).get(); long expectedEntryId = writer.write(entryId++, ByteBuffer.wrap(data)).get(); assertEquals(expectedEntryId, writer.getLastAddConfirmed()); } }

Target:
public void testWriteAdvHandleWithFixedLedgerId() throws Exception { setNewGeneratedLedgerId(12345); try (WriteAdvHandle writer = result(newCreateLedgerOp() .withAckQuorumSize(1) .withWriteQuorumSize(2) .withEnsembleSize(3) .withPassword(password) .makeAdv() .withLedgerId(1234) .execute());) { assertEquals(1234, writer.getId()); long entryId = 0; result(writer.write(entryId++, ByteBuffer.wrap(data))); result(writer.write(entryId++, Unpooled.wrappedBuffer(data))); long expectedEntryId = result(writer.write(entryId++, ByteBuffer.wrap(data))); assertEquals(expectedEntryId, writer.getLastAddConfirmed()); } }
Source:
public void lockLeasesAreValidUntilExpiry() { AsyncResult<HeldLocks> result = new AsyncResult<>(); AsyncResult<Leased<LockToken>> asyncResult = heldLocksCollection.getExistingOrAcquire(REQUEST_ID, () -> result); result.complete(heldLocksForId(REQUEST_ID)); Lease lease = asyncResult.get().lease(); assertThat(lease.isValid(leaderClock.time())).isTrue(); setTimeStatic(clock.get().plus(LockLeaseContract.CLIENT_LEASE_TIMEOUT.minus(Duration.ofNanos(1)))); assertThat(lease.isValid(leaderClock.time())).isTrue(); }

Target:
public void lockLeasesAreValidUntilExpiry() { setTime(123); AsyncResult<HeldLocks> result = new AsyncResult<>(); AsyncResult<Leased<LockToken>> asyncResult = heldLocksCollection.getExistingOrAcquire(REQUEST_ID, () -> result); result.complete(heldLocksForId(REQUEST_ID)); Lease lease = asyncResult.get().lease(); assertThat(lease.isValid(leaderClock.time())).isTrue(); advance(LockLeaseContract.CLIENT_LEASE_TIMEOUT.minus(Duration.ofNanos(1))); assertThat(lease.isValid(leaderClock.time())).isTrue(); }
Source:
public void inputKeyevent(int value) { executeCommandQuietly(adbCommand("shell", "input", "keyevent", "" + value)); sleep(600); }

Target:
public void inputKeyevent(int value) { executeCommandQuietly(adbCommand("shell", "input", "keyevent", "" + value)); sleep(500); }
Source:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { FilePath configFile = workspace.createTempFile(".kube", "config"); Set<String> tempFiles = newHashSet(configFile.getRemote()); context.env("KUBECONFIG", configFile.getRemote()); context.setDisposer(new CleanupDisposer(tempFiles)); final KubernetesAuth auth; try { auth = KubernetesAuthFactory.fromCredentialsId(credentialsId, serverUrl, null, true); } catch (KubernetesAuthException e) { throw new AbortException(e.getMessage()); } if (auth == null) { throw new AbortException("No credentials defined to setup Kubernetes CLI"); } try (Writer w = new OutputStreamWriter(new FileOutputStream(configFile.getRemote()), "UTF-8")) { if (auth instanceof KubernetesAuthKubeconfig) { w.write(((KubernetesAuthKubeconfig) auth).getKubeconfig()); } else { w.write(buildKubeConfig(auth)); } } int status = launcher.launch().cmdAsSingleString("kubectl version").join(); if (status != 0) throw new IOException("Failed to run kubectl version " + status); }

Target:
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException { FilePath configFile = workspace.createTempFile(".kube", "config"); Set<String> tempFiles = newHashSet(configFile.getRemote()); context.env("KUBECONFIG", configFile.getRemote()); context.setDisposer(new CleanupDisposer(tempFiles)); StandardCredentials credentials = CredentialsProvider.findCredentialById(credentialsId, StandardCredentials.class, build, Collections.emptyList()); if (credentials == null) { throw new AbortException("No credentials found for id \"" + credentialsId + "\""); } KubernetesAuth auth = AuthenticationTokens.convert(KubernetesAuth.class, credentials); if (auth == null) { throw new AbortException("Unsupported Credentials type " + credentials.getClass().getName()); } try (Writer w = new OutputStreamWriter(new FileOutputStream(configFile.getRemote()), "UTF-8")) { try { w.write(auth.buildKubeConfig(new KubernetesAuthConfig(getServerUrl(), getCaCertificate(), false))); } catch (KubernetesAuthException e) { throw new AbortException(e.getMessage()); } } int status = launcher.launch().cmdAsSingleString("kubectl version").join(); if (status != 0) throw new IOException("Failed to run kubectl version " + status); }
Source:
@Test public void test_async_invoke() throws Exception { client.setAsync(true); String jorge = client.get().sayHello("jorge"); Assert.assertTrue(jorge == null); Object o = RpcContext.getContext().getFuture().get(); Assert.assertTrue(o != null); Span span = takeSpan(); assertThat(span.kind()) .isEqualTo(Span.Kind.CLIENT); }

Target:
@Test public void test_async_invoke() throws Exception { client.setAsync(true); String jorge = client.get().sayHello("jorge"); assertThat(jorge).isNull(); Object o = RpcContext.getContext().getFuture().get(); assertThat(o).isNotNull(); Span span = takeSpan(); assertThat(span.kind()) .isEqualTo(Span.Kind.CLIENT); }
Source:
public InputStream getInputStream(RepoObject repoObject){ try { return new FileInputStream(getObjectLocationString(repoObject.getBucketName(), repoObject.getChecksum())); } catch (FileNotFoundException e) { return null; } }

Target:
public InputStream getInputStream(RepoObject repoObject){ try { return new FileInputStream(getObjectLocationString(repoObject.getBucketName(), repoObject.getChecksum())); } catch (FileNotFoundException e) { log.debug("The content for the object was not found. Object --> key , bucket name: , content checksum: , version number: ", repoObject.getKey(), repoObject.getBucketName(), repoObject.getChecksum(), repoObject.getVersionNumber()); return null; } }
Source:
public static void main(String[] args) { String filename = null; try { filename = args[0]; if (args.length > 1) throw new Exception(); } catch (Exception e) { logger.error("usage: java edu.illinois.cs.cogcomp.lbjava.edu.illinois.cs.cogcomp.lbjava.nlp.SentenceSplitter <file name>"); System.exit(1); } SentenceSplitter splitter = new SentenceSplitter(filename); for (Sentence s = (Sentence) splitter.next(); s != null; s = (Sentence) splitter.next()) { StringBuffer buffer = new StringBuffer(s.text); for (int i = 0; i < buffer.length(); ++i) { char c = buffer.charAt(i); if (c == '\n' || c == '\r' || c == '\f') buffer.setCharAt(i, ' '); } logger.info(buffer.toString()); } }

Target:
public static void main(String[] args) { String filename = null; try { filename = args[0]; if (args.length > 1) throw new Exception(); } catch (Exception e) { System.err.println("usage: java edu.illinois.cs.cogcomp.lbjava.edu.illinois.cs.cogcomp.lbjava.nlp.SentenceSplitter <file name>"); System.exit(1); } SentenceSplitter splitter = new SentenceSplitter(filename); for (Sentence s = (Sentence) splitter.next(); s != null; s = (Sentence) splitter.next()) { StringBuffer buffer = new StringBuffer(s.text); for (int i = 0; i < buffer.length(); ++i) { char c = buffer.charAt(i); if (c == '\n' || c == '\r' || c == '\f') buffer.setCharAt(i, ' '); } System.out.println(buffer.toString()); } }
Source:
private boolean isExpectedCondition(ExpectedCondition<?> expectedCondition) { WebDriverWait wait = new WebDriverWait(browser.driver, 0); try { wait.until(expectedCondition); return true; } catch (TimeoutException e) { return false; } }

Target:
private boolean isExpectedCondition(ExpectedCondition<?> expectedCondition) { Object value = expectedCondition.apply(browser.driver); if (value == null) { return false; } if (value.getClass() == Boolean.class) { return (boolean) value; } else { return true; } }
Source:
public void iteratesPullRequestComments() throws Exception { final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn(repo()).when(pull).repo(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, Json.createArrayBuilder() .add(comment("comment 3")) .add(comment("comment 4")) .build().toString() ) ).start(); final RtPullComments comments = new RtPullComments( new JdkRequest(container.home()), pull ); MatcherAssert.assertThat( comments.iterate(1, Collections.<String, String>emptyMap()), Matchers.<PullComment>iterableWithSize(2) ); container.stop(); }

Target:
public void iteratesPullRequestComments() throws Exception { final Pull pull = Mockito.mock(Pull.class); Mockito.doReturn(repo()).when(pull).repo(); final MkContainer container = new MkGrizzlyContainer().next( new MkAnswer.Simple( HttpURLConnection.HTTP_OK, Json.createArrayBuilder() .add(comment("comment 3")) .add(comment("comment 4")) .build().toString() ) ).start(); try { final RtPullComments comments = new RtPullComments( new JdkRequest(container.home()), pull ); MatcherAssert.assertThat( comments.iterate(1, Collections.<String, String>emptyMap()), Matchers.<PullComment>iterableWithSize(2) ); } finally { container.stop(); } }
Source:
public void onFields(long line, ObjList<DirectByteCharSequence> values, int valuesLength) { long timestamp = 0L; if (timestampIndex != -1 && types.getQuick(timestampIndex).getType() == ColumnType.TIMESTAMP) { TimestampAdapter adapter = (TimestampAdapter) types.getQuick(timestampIndex); final DirectByteCharSequence dbcs = values.getQuick(timestampIndex); try { timestamp = adapter.getTimestamp(dbcs); } catch (NumericException e) { logError(line, timestampIndex, dbcs); } } final TableWriter.Row w = writer.newRow(timestamp); for (int i = 0; i < valuesLength; i++) { if (i == timestampIndex && types.getQuick(timestampIndex).getType() == ColumnType.TIMESTAMP) { continue; } final DirectByteCharSequence dbcs = values.getQuick(i); if (dbcs.length() == 0) { continue; } try { types.getQuick(i).write(w, i, dbcs); } catch (Exception ignore) { logError(line, i, dbcs); switch (atomicity) { case Atomicity.SKIP_ALL: writer.rollback(); throw CairoException.instance(0).put("bad syntax [line=").put(line).put(", col=").put(i).put(']'); case Atomicity.SKIP_ROW: w.cancel(); return; default: break; } } } w.append(); }

Target:
public void onFields(long line, ObjList<DirectByteCharSequence> values, int valuesLength) { long timestamp = 0L; if (timestampAdapter != null) { final DirectByteCharSequence dbcs = values.getQuick(timestampIndex); try { timestamp = timestampAdapter.getTimestamp(dbcs); } catch (NumericException e) { logError(line, timestampIndex, dbcs); return; } } final TableWriter.Row w = writer.newRow(timestamp); for (int i = 0; i < valuesLength; i++) { if (timestampAdapter != null && i == timestampIndex) { continue; } final DirectByteCharSequence dbcs = values.getQuick(i); if (dbcs.length() == 0) { continue; } try { types.getQuick(i).write(w, i, dbcs); } catch (Exception ignore) { logError(line, i, dbcs); switch (atomicity) { case Atomicity.SKIP_ALL: writer.rollback(); throw CairoException.instance(0).put("bad syntax [line=").put(line).put(", col=").put(i).put(']'); case Atomicity.SKIP_ROW: w.cancel(); return; default: break; } } } w.append(); }
Source:
public void start() { try { MediaServerConfiguration conf = configurationLoader.load(this.filepath); Injector injector = Guice.createInjector(new BootstrapModule(conf)); this.mediaServer = injector.getInstance(RestCommMediaServer.class); this.mediaServer.start(); } catch (Exception e) { log.error("Bootstrap aborted."); } }

Target:
public void start() { try { MediaServerConfiguration conf = configurationLoader.load(this.filepath); Injector injector = Guice.createInjector(new BootstrapModule(conf)); this.mediaServer = injector.getInstance(RestCommMediaServer.class); this.mediaServer.start(); } catch (Exception e) { log.error("Bootstrap aborted. Reason: " + e.getMessage()); } }
Source:
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) { return isInitialized == 1; } for (int i = 0; i < getLocalTimeCount(); i++) { if (!getLocalTime(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }

Target:
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getLocalTimeCount(); i++) { if (!getLocalTime(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; }
Source:
public void write(ItemRecord[] records, IProgressMonitor monitor) { if (monitor == null) { monitor = new NullProgressMonitor(); } try { for (ItemRecord record : records) { if (monitor.isCanceled()) { break; } Map<IPath, IPath> toImportMap = mapping(record); monitor.subTask(DefaultMessagesImpl.getString("Exporting ", record.getName())); if (record.isValid()) { for (IPath resPath : toImportMap.keySet()) { IPath desPath = toImportMap.get(resPath); synchronized (ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider() .getResourceManager().resourceSet) { write(resPath, desPath); } } } else { for (String error : record.getErrors()) { log.error(error); } } monitor.worked(1); } finish(records); } catch (Exception e) { log.error(e, e); } }

Target:
public void write(ItemRecord[] records, IProgressMonitor monitor) { if (monitor == null) { monitor = new NullProgressMonitor(); } try { for (ItemRecord record : records) { if (monitor.isCanceled()) { break; } Map<IPath, IPath> toImportMap = mapping(record); monitor.subTask(DefaultMessagesImpl.getString("FileSystemExportWriter.Export", record.getName())); if (record.isValid()) { for (IPath resPath : toImportMap.keySet()) { IPath desPath = toImportMap.get(resPath); synchronized (ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider() .getResourceManager().resourceSet) { write(resPath, desPath); } } } else { for (String error : record.getErrors()) { log.error(error); } } monitor.worked(1); } finish(records); } catch (Exception e) { log.error(e, e); } }
Source:
public Stream getStream(String streamName) throws AphroditeException{ if (streamName == null) { throw new AphroditeException("stream name is null."); } else { for (StreamService ss : streams) { return ss.getStream(streamName); } } throw new AphroditeException("the stream service has not been initial."); }

Target:
public Stream getStream(String streamName) throws AphroditeException { checkStreamServiceExists(); Objects.requireNonNull(streamName,"stream name can not be null"); for (StreamService ss : streams) { return ss.getStream(streamName); } throw new AphroditeException("the stream service has not been initial."); }
Source:
public void setSelection(int index) { if (fTableItemCount > 0) { int i = Math.min(index, fTableItemCount - 1); i = Math.max(i, 0); fSelectedEventRank = i; fSelectedBeginRank = fSelectedEventRank; if ((i < fTableTopEventRank + fFrozenRowCount && i >= fFrozenRowCount) || (i >= fTableTopEventRank + fFullyVisibleRows)) { int lastPageTopEntryRank = Math.max(0, fTableItemCount - fFullyVisibleRows); fTableTopEventRank = Math.max(0, Math.min(lastPageTopEntryRank, i - fFrozenRowCount - fFullyVisibleRows / 2)); } if (fFullyVisibleRows < fTableItemCount) { fSlider.setSelection(fTableTopEventRank); } refreshTable(); } }

Target:
public void setSelection(int index) { setSelectionRange(index, index); }
Source:
public Result doWork() { final boolean[] result = new boolean[1]; String patientIdTobeUpdated = getInputData().getString("_id"); PatientDAO patientDAO = new PatientDAO(); Patient patientTobeUpdated = patientDAO.findPatientByID(patientIdTobeUpdated); updatePatient(patientTobeUpdated, new DefaultResponseCallbackListener() { @Override public void onResponse() { result[0] = true; Message msg = new Message(); msg.obj = patientTobeUpdated.getPerson().getName().getNameString(); msg.what = ON_SUCCESS; mHandler.sendMessage(msg); } @Override public void onErrorResponse(String errorMessage) { result[0] = false; Message msg = new Message(); msg.obj = patientTobeUpdated.getPerson().getName().getNameString(); msg.what = ON_FAILURE; mHandler.sendMessage(msg); } }); return result[0] ? Result.success() : Result.retry(); }

Target:
public Result doWork() { final boolean[] result = new boolean[1]; String patientIdTobeUpdated = getInputData().getString(ApplicationConstants.PRIMARY_KEY_ID); PatientDAO patientDAO = new PatientDAO(); Patient patientTobeUpdated = patientDAO.findPatientByID(patientIdTobeUpdated); updatePatient(patientTobeUpdated, new DefaultResponseCallbackListener() { @Override public void onResponse() { result[0] = true; Message msg = new Message(); msg.obj = patientTobeUpdated.getPerson().getName().getNameString(); msg.what = ON_SUCCESS; mHandler.sendMessage(msg); } @Override public void onErrorResponse(String errorMessage) { result[0] = false; Message msg = new Message(); msg.obj = patientTobeUpdated.getPerson().getName().getNameString(); msg.what = ON_FAILURE; mHandler.sendMessage(msg); } }); return result[0] ? Result.success() : Result.retry(); }
Source:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { if (data != null && data.getBooleanExtra(EditPostActivity.EXTRA_HAS_CHANGES, false)) { if (data.getBooleanExtra(EditPostActivity.EXTRA_SAVED_AS_LOCAL_DRAFT, false)) { Snackbar.make(findViewById(R.id.coordinator), R.string.editor_post_saved_locally, Snackbar.LENGTH_LONG).show(); } else { Snackbar.make(findViewById(R.id.coordinator), R.string.editor_post_saved_online, Snackbar.LENGTH_LONG).show(); } } } }

Target:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RequestCodes.EDIT_POST) { mPostList.handleEditPostResult(resultCode, data); } }
Source:
public TimestampedWindowStore<K, V> build() { WindowStore<Bytes, byte[]> store = storeSupplier.get(); if (!(store instanceof TimestampedBytesStore)) { if (store.persistent()) { store = new WindowToTimestampedWindowByteStoreAdapter(store); } else { store = new InMemoryTimestampedWindowStoreMarker(store); } } if (storeSupplier.retainDuplicates()) { log.warn("Disabling caching for since store was configured to retain duplicates", storeSupplier.name()); enableCaching = false; } return new MeteredTimestampedWindowStore<>( maybeWrapCaching(maybeWrapLogging(store)), storeSupplier.windowSize(), storeSupplier.metricsScope(), time, keySerde, valueSerde); }

Target:
public TimestampedWindowStore<K, V> build() { WindowStore<Bytes, byte[]> store = storeSupplier.get(); if (!(store instanceof TimestampedBytesStore)) { if (store.persistent()) { store = new WindowToTimestampedWindowByteStoreAdapter(store); } else { store = new InMemoryTimestampedWindowStoreMarker(store); } } if (storeSupplier.retainDuplicates() && enableCaching) { log.warn("Disabling caching for since store was configured to retain duplicates", storeSupplier.name()); enableCaching = false; } return new MeteredTimestampedWindowStore<>( maybeWrapCaching(maybeWrapLogging(store)), storeSupplier.windowSize(), storeSupplier.metricsScope(), time, keySerde, valueSerde); }
Source:
public RegionRedundancyStatusImpl(int configuredRedundancy, int actualRedundancy, String regionName, RedundancyStatus status) { this.configuredRedundancy = configuredRedundancy; this.actualRedundancy = actualRedundancy; this.regionName = regionName; this.status = status; }

Target:
RegionRedundancyStatusImpl(int configuredRedundancy, int actualRedundancy, String regionName, RedundancyStatus status) { this.configuredRedundancy = configuredRedundancy; this.actualRedundancy = actualRedundancy; this.regionName = regionName; this.status = status; }
Source:
public Boolean isRebaseTransparent() { return isRebaseTransparent; }

Target:
public boolean isRebaseTransparent() { return isRebaseTransparent; }
Source:
protected Predicate<DetailedS3Object> getNamePredicate() throws CommandException { if (Guard.isMapNullOrEmpty(this.filterParams)) { return Predicates.notNull(); } final String contains = metaLookup(CONTAINS); if (Guard.isStringNullOrEmpty(contains)) { return Predicates.notNull(); } return new Predicate<DetailedS3Object>() { @Override public boolean apply(@Nullable final DetailedS3Object input) { return input.getName().contains(contains); } }; }

Target:
private Predicate<DetailedS3Object> getNamePredicate() throws CommandException { if (Guard.isMapNullOrEmpty(this.filterParams)) { return Predicates.notNull(); } final String contains = paramLookup(CONTAINS); if (Guard.isStringNullOrEmpty(contains)) { return Predicates.notNull(); } return new Predicate<DetailedS3Object>() { @Override public boolean apply(@Nullable final DetailedS3Object input) { return input.getName().contains(contains); } }; }
Source:
protected Type toPrestoType(int jdbcType, int columnSize, int decimalDigits) { switch (jdbcType) { case Types.BIT: case Types.BOOLEAN: return BOOLEAN; case Types.TINYINT: return TINYINT; case Types.SMALLINT: return SMALLINT; case Types.INTEGER: return INTEGER; case Types.BIGINT: return BIGINT; case Types.REAL: return REAL; case Types.FLOAT: case Types.DOUBLE: return DOUBLE; case Types.NUMERIC: case Types.DECIMAL: return createDecimalType(columnSize, decimalDigits); case Types.CHAR: case Types.NCHAR: return createCharType(min(columnSize, CharType.MAX_LENGTH)); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: if (columnSize > VarcharType.MAX_LENGTH) { return createUnboundedVarcharType(); } return createVarcharType(columnSize); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return VARBINARY; case Types.DATE: return DATE; case Types.TIME: return TIME; case Types.TIMESTAMP: return TIMESTAMP; } return null; }

Target:
protected Type toPrestoType(int jdbcType, int columnSize, int decimalDigits) { switch (jdbcType) { case Types.BIT: case Types.BOOLEAN: return BOOLEAN; case Types.TINYINT: return TINYINT; case Types.SMALLINT: return SMALLINT; case Types.INTEGER: return INTEGER; case Types.BIGINT: return BIGINT; case Types.REAL: return REAL; case Types.FLOAT: case Types.DOUBLE: return DOUBLE; case Types.NUMERIC: case Types.DECIMAL: int precision = columnSize + max(-decimalDigits, 0); if (precision > Decimals.MAX_PRECISION) { return null; } return createDecimalType(precision, max(decimalDigits, 0)); case Types.CHAR: case Types.NCHAR: return createCharType(min(columnSize, CharType.MAX_LENGTH)); case Types.VARCHAR: case Types.NVARCHAR: case Types.LONGVARCHAR: case Types.LONGNVARCHAR: if (columnSize > VarcharType.MAX_LENGTH) { return createUnboundedVarcharType(); } return createVarcharType(columnSize); case Types.BINARY: case Types.VARBINARY: case Types.LONGVARBINARY: return VARBINARY; case Types.DATE: return DATE; case Types.TIME: return TIME; case Types.TIMESTAMP: return TIMESTAMP; } return null; }
Source:
public void setStatusString(String statusString, boolean isSuccessful) { this.statusString = statusString; if (statusHistory.length() > historyMaxSize) { statusHistory.delete(0, statusString.length() + 1); int lineEnd = statusHistory.indexOf("\n"); if (lineEnd >= 0) { statusHistory.delete(0, lineEnd+1); } } statusHistory.append("\n"); statusHistory.append(statusString); this.isSuccessful = this.isSuccessful && isSuccessful; }

Target:
public void setStatusString(String statusString, boolean isSuccessful) { this.statusString = statusString; if (statusHistory.length() > STATUS_HISTORY_MAX_BYTES) { trimHistory(statusString.length()); } statusHistory.append("\n"); statusHistory.append(statusString); this.isSuccessful = this.isSuccessful && isSuccessful; }
Source:
private ExchangeType onServerNodeEvent(boolean crd) throws IgniteCheckedException { assert !firstDiscoEvt.eventNode().isClient() : this; if (firstDiscoEvt.type() == EVT_NODE_LEFT || firstDiscoEvt.type() == EVT_NODE_FAILED) { onLeft(); exchCtx.events().warnNoAffinityNodes(cctx); centralizedAff = exchCtx.baselineNodeLeft() ? cctx.affinity().onBaselineNodeLeft(this, crd) : cctx.affinity().onCentralizedAffinityChange(this, crd); } else cctx.affinity().onServerJoin(this, crd); return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL; }

Target:
private ExchangeType onServerNodeEvent(boolean crd) throws IgniteCheckedException { assert !firstDiscoEvt.eventNode().isClient() : this; if (firstDiscoEvt.type() == EVT_NODE_LEFT || firstDiscoEvt.type() == EVT_NODE_FAILED) { onLeft(); exchCtx.events().warnNoAffinityNodes(cctx); centralizedAff = cctx.affinity().onCentralizedAffinityChange(this, crd); } else cctx.affinity().onServerJoin(this, crd); return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL; }
Source:
public int getMetaFromState(IBlockState state) { int i = 0; if (state.getValue(POWERED)) { i = 1; } return i; }

Target:
public int getMetaFromState(IBlockState state) { return state.getValue(POWERED) ? 1 : 0; }
Source:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); entry.enabled = EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (entry.enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); activatedEntries.put(entry.getName(), entry); MultiValueMapUtils.addToMap(entry.getProvides(), entry, providesEntries); } catch (Exception ex) { entry.enabled = false; log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }

Target:
private synchronized void loadImpl(Properties props, File confFile) { ExtensionEntry entry = new ExtensionEntry(props, confFile); ExtensionEntry alreadyLoadedEntry = loadedEntries.get(entry.getName()); if (alreadyLoadedEntry != null) { throw new ConfigurationException(String.format( "Could not load the configuration '%1$s' from file %2$s. A configuration with the same name was already loaded from file %3$s", entry.getName(), getFileName(entry.file), getFileName(alreadyLoadedEntry.file)) ); } loadedEntries.put(entry.getName(), entry); boolean enabled = EngineLocalConfig.getInstance().getBoolean(ENGINE_EXTENSION_ENABLED + entry.getName(), entry.enabled); if (enabled && entry.extension == null) { try { entry.extension = (Extension) lookupService( Extension.class, entry.getConfig().getProperty(CLASS), entry.getConfig().getProperty(MODULE) ).newInstance(); entry.extension.setContext(entry.context); entry.extension.init(); entry.activated = true; activatedEntries.put(entry.getName(), entry); for (String provides : entry.getProvides()) { MultiValueMapUtils.addToMap(provides, entry, providesEntries); } } catch (Exception ex) { log.error( String.format( "Error in activating extension %1$s. Exception message is %2$s", entry.getName(), ex.getMessage() ) ); if (log.isDebugEnabled()) { log.error("", ex); } } } }
Source:
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { if (!httpClient.isStarted()) { try { this.httpClient.start(); } catch (Exception ex) { return Mono.error(ex); } } if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest(httpClient.newRequest(uri).method(method.toString())); return requestCallback.apply(clientHttpRequest).then(clientHttpRequest.getResponse()); }

Target:
public Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, Mono<Void>> requestCallback) { if (!uri.isAbsolute()) { return Mono.error(new IllegalArgumentException("URI is not absolute: " + uri)); } if (!httpClient.isStarted()) { try { this.httpClient.start(); } catch (Exception ex) { return Mono.error(ex); } } JettyClientHttpRequest clientHttpRequest = new JettyClientHttpRequest( httpClient.newRequest(uri).method(method.toString()), bufferFactory); return requestCallback.apply(clientHttpRequest).then( Mono.from(clientHttpRequest.getReactiveRequest().response((reactiveResponse, contentChunks) -> { Flux<DataBuffer> content = Flux.from(contentChunks).map(chunk -> { DataBuffer buffer = this.bufferFactory.allocateBuffer(chunk.buffer.capacity()); buffer.write(chunk.buffer); chunk.callback.succeeded(); return buffer; }); return Mono.just(new JettyClientHttpResponse(reactiveResponse, content)); }))); }
Source:
public ApiFuture<List<Result>> readRowsAsync(Query request) { return delegate.readRowsCallable(new ResultRowAdapter()).all().futureCall(request); }

Target:
public ApiFuture<List<Result>> readRowsAsync(Query request) { return delegate.readRowsCallable(RESULT_ADAPTER).all().futureCall(request); }
Source:
public IBuild trigger() { IBuildRequest request = client.getResourceFactory().stub(ResourceKind.BUILD_REQUEST, resource.getName()); if (commitId != null && commitId.length() > 0) request.setCommitId(commitId); for (String cause : causes) { request.addBuildCause(cause); } return client.create(resource.getKind(), resource.getNamespace(), resource.getName(), subresource, request); }

Target:
public IBuild trigger() { IBuildRequest request = client.getResourceFactory().stub(ResourceKind.BUILD_REQUEST, resource.getName()); if(StringUtils.isNotEmpty(commitId)) request.setCommitId(commitId); causes.forEach(c->request.addBuildCause(c)); return client.create(resource.getKind(), resource.getNamespace(), resource.getName(), subresource, request); }
Source:
public static void main(String[] args) throws Exception { Files.write(new ClosureToDts(new Compiler(System.out)) .translate(Lists.transform(asList(args).subList(1, args.length), new Function<String, SourceFile>() { @Override public SourceFile apply(String input) { return SourceFile.fromFile(input, StandardCharsets.UTF_8); } })), new File(args[0]), StandardCharsets.UTF_8); }

Target:
public static void main(String[] args) throws Exception { List<String> inputFiles = asList(args).subList(1, args.length); String dtsContent = new ClosureToDts(new Compiler(System.out)) .translate(transform(inputFiles, TO_SOURCE_FILE)); Files.write(dtsContent, new File(args[0]), StandardCharsets.UTF_8); }
Source:
public String getLayoutAsJson(final Structure structure, final User user) { try { String languageId = request.getParameter("languageId"); if (languageId == null) { languageId = (String) request.getSession().getAttribute( com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE); } final StructureTransformer transformer = new StructureTransformer(structure); final ContentType contentType = transformer.from(); final boolean live = (PageMode.get(Try.of(() -> HttpServletRequestThreadLocal.INSTANCE.getRequest()).getOrNull())).showLive; final ContentTypeInternationalization contentTypeInternationalization = languageId != null ? new ContentTypeInternationalization(Long.parseLong(languageId), live, user) : null; final FieldLayout layout = APILocator.getContentTypeFieldLayoutAPI().getLayout(contentType.id(), user); layout.setContentTypeInternationalization(contentTypeInternationalization); return MAPPER.writeValueAsString(layout); } catch (DotDataException | DotSecurityException | JsonProcessingException e) { throw new DotRuntimeException(e); } }

Target:
public String getLayoutAsJson(final Structure structure, final User user) { try { final Language language = WebAPILocator.getLanguageWebAPI().getLanguage(request); final StructureTransformer transformer = new StructureTransformer(structure); final ContentType contentType = transformer.from(); final boolean live = (PageMode.get(Try.of(() -> HttpServletRequestThreadLocal.INSTANCE.getRequest()).getOrNull())).showLive; final ContentTypeInternationalization contentTypeInternationalization = language != null ? new ContentTypeInternationalization(language.getId(), live, user) : null; final FieldLayout layout = APILocator.getContentTypeFieldLayoutAPI().getLayout(contentType.id(), user); layout.setContentTypeInternationalization(contentTypeInternationalization); return MAPPER.writeValueAsString(layout); } catch (DotDataException | DotSecurityException | JsonProcessingException e) { throw new DotRuntimeException(e); } }
Source:
public void TestExist() { BtfTrace fixture = (BtfTrace) BtfTestTrace.BTF_TEST.getTrace(); assertNotNull(fixture); }

Target:
public void TestExist() { fixture = BtfTestTrace.BTF_TEST.getTrace(); assertNotNull(fixture); }