auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void doUnicityCheck(DocumentModel doc2Check, CoreSession session, Event event) { List<String> xpathFields = Framework.getRuntime().getService(FileManager.class).getFields(); if (xpathFields == null || xpathFields.isEmpty()) { unicityCheckEnabled = false; log.info("Unicity check has been automatically disabled"); return; } for (String field : xpathFields) { Blob blob; try { blob = (Blob) doc2Check.getPropertyValue(field); } catch (PropertyNotFoundException pnfe) { continue; } if (blob == null) { log.debug("No blob retrieved"); continue; } String digest = blob.getDigest(); if (digest == null) { log.debug("Blob has no digest, can not check for unicity"); continue; } List<DocumentLocation> existingDocuments = null; existingDocuments = fileManager.findExistingDocumentWithFile(session, doc2Check.getPathAsString(), digest, session.getPrincipal()); if (!existingDocuments.isEmpty()) { Iterator<DocumentLocation> existingDocumentsIterator = existingDocuments.iterator(); while (existingDocumentsIterator.hasNext()) { if (existingDocumentsIterator.next().getDocRef() == doc2Check.getRef()) { existingDocumentsIterator.remove(); } } log.debug("Existing Documents[" + existingDocuments.size() + "]"); onDuplicatedDoc(session, session.getPrincipal(), doc2Check, existingDocuments, event); } } }

Target:
protected void doUnicityCheck(DocumentModel doc2Check, CoreSession session, Event event) { List<String> xpathFields = Framework.getService(FileManager.class).getFields(); if (xpathFields == null || xpathFields.isEmpty()) { unicityCheckEnabled = false; log.info("Unicity check has been automatically disabled"); return; } for (String field : xpathFields) { Blob blob; try { blob = (Blob) doc2Check.getPropertyValue(field); } catch (PropertyNotFoundException pnfe) { continue; } if (blob == null) { log.debug("No blob retrieved"); continue; } String digest = blob.getDigest(); if (digest == null) { log.debug("Blob has no digest, can not check for unicity"); continue; } List<DocumentLocation> existingDocuments = null; existingDocuments = fileManager.findExistingDocumentWithFile(session, doc2Check.getPathAsString(), digest, session.getPrincipal()); if (!existingDocuments.isEmpty()) { Iterator<DocumentLocation> existingDocumentsIterator = existingDocuments.iterator(); while (existingDocumentsIterator.hasNext()) { if (existingDocumentsIterator.next().getDocRef() == doc2Check.getRef()) { existingDocumentsIterator.remove(); } } log.debug("Existing Documents[" + existingDocuments.size() + "]"); onDuplicatedDoc(session, session.getPrincipal(), doc2Check, existingDocuments, event); } } }
Source:
private boolean shouldOwnMorePartitions(final int minPartitionsPerEventProcessor, final Map<String, List<PartitionOwnership>> ownerPartitionMap) { int numberOfPartitionsOwned = ownerPartitionMap.get(this.ownerId).size(); int leastPartitionsOwnedByAnyEventProcessor = ownerPartitionMap.values().stream().min(Comparator.comparingInt(List::size)).get().size(); if (numberOfPartitionsOwned < minPartitionsPerEventProcessor || numberOfPartitionsOwned == leastPartitionsOwnedByAnyEventProcessor) { return true; } return false; }

Target:
private boolean shouldOwnMorePartitions(final int minPartitionsPerEventProcessor, final Map<String, List<PartitionOwnership>> ownerPartitionMap) { int numberOfPartitionsOwned = ownerPartitionMap.get(this.ownerId).size(); int leastPartitionsOwnedByAnyEventProcessor = ownerPartitionMap.values().stream().min(Comparator.comparingInt(List::size)).get().size(); return numberOfPartitionsOwned < minPartitionsPerEventProcessor || numberOfPartitionsOwned == leastPartitionsOwnedByAnyEventProcessor; }
Source:
public void setUp() { if (Display.getCurrent() != null) { log.warn("SWTBot tests must NOT run in the UI Thread"); } }

Target:
public void setUp() { if (Display.getCurrent() != null) { log.warn("SWTBot test needs to run in a non-UI thread.\n" + "Make sure that \"Run in UI thread\" is unchecked in your launch configuration or that useUIThread is set to false in the pom.xml"); } }
Source:
protected String[] customCommandLineValidation() { List<String> errors = new ArrayList<String>(); ValidationUtil.validateSanitizeSortOrder(SANITIZE, SORT_ORDER, errors); ValidationUtil.validateOutputParams(OUTPUT_BY_READGROUP, OUTPUT, OUTPUT_MAP, errors); if (!errors.isEmpty()) { return errors.toArray(new String[errors.size()]); } return null; }

Target:
protected String[] customCommandLineValidation() { final List<String> errors = new ArrayList<String>(); ValidationUtil.validateSanitizeSortOrder(SANITIZE, SORT_ORDER, errors); ValidationUtil.validateOutputParams(OUTPUT_BY_READGROUP, OUTPUT, OUTPUT_MAP, errors); if (!errors.isEmpty()) { return errors.toArray(new String[errors.size()]); } return null; }
Source:
public void testJoinsOfInExists() throws Exception { Client client = getClient(); loadData(false); String sql; for (String tb: replicated_tbs) { sql = "select T1.id from R1 T1, " + tb + " T2 " + "where T1.id = T2.id " + "and exists " + " (select 1 from R1 where R1.dept * 2 = T2.dept) " + "order by t1.id;"; validateTableOfLongs(client, sql, new long[][] {{4}, {5}}); sql = "select t1.id, t2.id from r1 t1, " + tb + " t2 " + "where t1.id IN " + " (select id from r2 where t2.id = r2.id * 2) " + "order by t1.id;"; validateTableOfLongs(client, sql, new long[][] {{1,2}, {2,4}}); if (!isHSQL()) { sql = "select id, newid " + "from (select id, wage from R1) T1 " + " LEFT OUTER JOIN " + " (select id as newid, dept from " + tb + " where dept > 1) T2 " + " ON T1.id = T2.dept " + " and exists " + " (select 1 from R1 where R1.ID = T2.newid) " + "order by id, newid;"; validateTableOfLongs(client, sql, new long[][] { {1, Long.MIN_VALUE}, {2, 4}, {2, 5}, {3, Long.MIN_VALUE}, {4, Long.MIN_VALUE}, {5, Long.MIN_VALUE}}); } } }

Target:
public void testJoinsOfInExists() throws Exception { Client client = getClient(); loadData(false); String sql; for (String tb: replicated_tbs) { sql = "select T1.id from R1 T1, " + tb + " T2 " + "where T1.id = T2.id " + "and exists " + " (select 1 from R1 where R1.dept * 2 = T2.dept) " + "order by id;"; validateTableOfLongs(client, sql, new long[][] {{4}, {5}}); sql = "select t1.id, t2.id from r1 t1, " + tb + " t2 " + "where t1.id IN " + " (select id from r2 where t2.id = r2.id * 2) " + "order by t1.id;"; validateTableOfLongs(client, sql, new long[][] {{1,2}, {2,4}}); if (!isHSQL()) { sql = "select id, newid " + "from (select id, wage from R1) T1 " + " LEFT OUTER JOIN " + " (select id as newid, dept from " + tb + " where dept > 1) T2 " + " ON T1.id = T2.dept " + " and exists " + " (select 1 from R1 where R1.ID = T2.newid) " + "order by id, newid;"; validateTableOfLongs(client, sql, new long[][] { {1, Long.MIN_VALUE}, {2, 4}, {2, 5}, {3, Long.MIN_VALUE}, {4, Long.MIN_VALUE}, {5, Long.MIN_VALUE}}); } } }
Source:
public SpectatorRequestMetricCollector(Registry registry, Map<String, String> customTags) { this.registry = Preconditions.checkNotNull(registry, "registry"); this.customTags = Preconditions.checkNotNull(customTags, "customTags"); }

Target:
public SpectatorRequestMetricCollector(Registry registry, Map<String, String> customTags) { super(); this.registry = Preconditions.checkNotNull(registry, "registry"); Preconditions.checkNotNull(customTags, "customTags"); this.customTags = new HashMap<>(); customTags.forEach((key, value) -> { if (ALL_DEFAULT_TAGS.contains(key)) { registry.propagate(new IllegalArgumentException("Invalid custom tag " + key + " - cannot override built-in tag")); } else { this.customTags.put(key, value); } }); }
Source:
public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = super.getCreatableProperties(); description.addProperty("name"); description.addProperty("location"); description.addProperty("description"); return description; }

Target:
public DelegatingResourceDescription getCreatableProperties() { DelegatingResourceDescription description = super.getCreatableProperties(); description.addProperty("location"); return description; }
Source:
public void testSimple() { assertSymbolEquals("a > b"); assertSymbolEquals("a + b > c"); assertSymbolEquals("sin(a) - b"); assertSymbolEquals("sin(a) + cos(a) - b"); assertSymbolEquals("sin(a) + cos(a) + a - b"); assertSymbolEquals("COALESCE(a, b, 1)"); assertSymbolEquals("a IN (a, b, c)"); assertSymbolEquals("transform(sequence(1, 5), a -> a + b)"); assertSymbolEquals("bigint '1'"); }

Target:
public void testSimple() { assertSymbols("a > b"); assertSymbols("a + b > c"); assertSymbols("sin(a) - b"); assertSymbols("sin(a) + cos(a) - b"); assertSymbols("sin(a) + cos(a) + a - b"); assertSymbols("COALESCE(a, b, 1)"); assertSymbols("a IN (a, b, c)"); assertSymbols("transform(sequence(1, 5), a -> a + b)"); assertSymbols("bigint '1'"); }
Source:
public void testDisconnectWhenConnectionBreak() throws Exception { _zkServerRef.get().shutdown(); AtomicBoolean disconnected = new AtomicBoolean(false); Thread testThread = new Thread("Testing HelixManager disconnect") { @Override public void run() { _controller.disconnect(); disconnected.set(true); } }; try { testThread.start(); testThread.join(5000); Assert.assertTrue(disconnected.get()); Assert.assertFalse(_controller.isConnected()); } finally { testThread.interrupt(); _zkServerRef.set(TestHelper.startZkServer(_zkAddr, null, false)); } }

Target:
public void testDisconnectWhenConnectionBreak() throws Exception { String controllerName = CONTROLLER_PREFIX + "_" + TestHelper.getTestMethodName(); ClusterControllerManager controllerManager = new ClusterControllerManager(_zkAddr, CLUSTER_NAME, controllerName); controllerManager.syncStart(); TestHelper.stopZkServer(_zkServerRef.get()); AtomicBoolean disconnected = new AtomicBoolean(false); Thread testThread = new Thread("Testing HelixManager disconnect") { @Override public void run() { controllerManager.disconnect(); disconnected.set(true); } }; try { testThread.start(); testThread.join(10000); Assert.assertTrue(disconnected.get()); Assert.assertFalse(controllerManager.isConnected()); } finally { testThread.interrupt(); _zkServerRef.set(TestHelper.startZkServer(_zkAddr, null, false)); } }
Source:
private void setupCivicAPIListeners(View rootView) { voterInfoListener = (result) -> { if (result == null) { Log.d("HomeFragment", "Null result"); homeGoButton.setVisibility(View.INVISIBLE); return; } VoterInfo voterInfo = (VoterInfo) result; homeTextViewStatus.setVisibility(View.GONE); homeGoButton.setVisibility(View.VISIBLE); mListener.searchedAddress(voterInfo); }; voterInfoErrorListener = (result) -> { if (result == null) { Log.e("HomeFragment", "Null error result"); homeTextViewStatus.setText(R.string.home_error_no_address); homeGoButton.setVisibility(View.INVISIBLE); return; } CivicApiError error = (CivicApiError) result; Log.d("HomeFragment", "Civic API returned error"); Log.d("HomeFragment", error.code + ": " + error.message); CivicApiError.Error error1 = error.errors.get(0); if (error1 != null) { Log.d("HomeFragment", error1.domain + " " + error1.reason + " " + error1.message); if (CivicApiError.errorMessages.get(error1.reason) != null) { homeTextViewStatus.setText(CivicApiError.errorMessages.get(error1.reason)); } else { Log.d("HomeFragment", "Unknown API error reason: " + error1.reason); homeTextViewStatus.setText(R.string.home_error_unknown); } } else { homeTextViewStatus.setText(R.string.home_error_unknown); } }; }

Target:
private void setupCivicAPIListeners(View rootView) { voterInfoListener = (result) -> { if (result == null) { return; } VoterInfo voterInfo = (VoterInfo) result; homeTextViewStatus.setVisibility(View.GONE); homeGoButton.setVisibility(View.VISIBLE); mListener.searchedAddress(voterInfo); }; voterInfoErrorListener = (result) -> { try { homeGoButton.setVisibility(View.INVISIBLE); CivicApiError error = (CivicApiError) result; Log.d("HomeFragment", "Civic API returned error"); Log.d("HomeFragment", error.code + ": " + error.message); CivicApiError.Error error1 = error.errors.get(0); Log.d("HomeFragment", error1.domain + " " + error1.reason + " " + error1.message); if (CivicApiError.errorMessages.get(error1.reason) != null) { homeTextViewStatus.setText(CivicApiError.errorMessages.get(error1.reason)); } else { Log.d("HomeFragment", "Unknown API error reason: " + error1.reason); homeTextViewStatus.setText(R.string.home_error_unknown); } } catch(NullPointerException e) { Log.e("HomeFragment", "Null encountered in API error result"); homeTextViewStatus.setText(R.string.home_error_unknown); } }; }
Source:
private void doFlush() { while (!mStopFlushing) { while (mQueue.isEmpty() && !mStopFlushing) { try { if (mFlushSemaphore.tryAcquire(mFlushBatchTimeNs, TimeUnit.NANOSECONDS)) { break; } } catch (InterruptedException ie) { break; } } try { long startTime = System.nanoTime(); while (!mQueue.isEmpty()) { JournalEntry entry = mQueue.peek(); if (entry == null) { break; } mJournalWriter.write(entry); JournalUtils.sinkAppend(mJournalSinks, entry); mQueue.poll(); mWriteCounter++; if (((System.nanoTime() - startTime) >= mFlushBatchTimeNs) && !mStopFlushing) { break; } } if (mFlushCounter.get() < mWriteCounter) { try (Timer.Context ctx = MetricsSystem .timer(MetricKey.MASTER_JOURNAL_FLUSH_TIMER.getName()).time()) { mJournalWriter.flush(); } JournalUtils.sinkFlush(mJournalSinks); mFlushCounter.set(mWriteCounter); } Iterator<FlushTicket> ticketIterator = mTicketSet.iterator(); while (ticketIterator.hasNext()) { FlushTicket ticket = ticketIterator.next(); if (ticket.getTargetCounter() <= mFlushCounter.get()) { ticket.setCompleted(); ticketIterator.remove(); } } } catch (IOException | JournalClosedException exc) { LOG.debug("Failed to flush journal entry", exc); Metrics.JOURNAL_FLUSH_FAILURE.inc(); Iterator<FlushTicket> ticketIterator = mTicketSet.iterator(); while (ticketIterator.hasNext()) { FlushTicket ticket = ticketIterator.next(); ticketIterator.remove(); if (ticket.getTargetCounter() <= mFlushCounter.get()) { ticket.setCompleted(); } else { ticket.setError(exc); } } } } }

Target:
private void doFlush() { while (!mStopFlushing) { while (mQueue.isEmpty() && !mStopFlushing) { try { if (mFlushSemaphore.tryAcquire(mFlushBatchTimeNs, TimeUnit.NANOSECONDS)) { break; } } catch (InterruptedException ie) { break; } } try { long startTime = System.nanoTime(); while (!mQueue.isEmpty()) { JournalEntry entry = mQueue.peek(); if (entry == null) { break; } mJournalWriter.write(entry); JournalUtils.sinkAppend(mJournalSinks, entry); mQueue.poll(); mWriteCounter++; if (((System.nanoTime() - startTime) >= mFlushBatchTimeNs) && !mStopFlushing) { break; } } if (mFlushCounter.get() < mWriteCounter) { try (Timer.Context ctx = MetricsSystem .timer(MetricKey.MASTER_JOURNAL_FLUSH_TIMER.getName()).time()) { mJournalWriter.flush(); } JournalUtils.sinkFlush(mJournalSinks); mFlushCounter.set(mWriteCounter); } Iterator<FlushTicket> ticketIterator = mTicketSet.iterator(); while (ticketIterator.hasNext()) { FlushTicket ticket = ticketIterator.next(); if (ticket.getTargetCounter() <= mFlushCounter.get()) { ticket.setCompleted(); ticketIterator.remove(); } } } catch (IOException | JournalClosedException exc) { SAMPLING_LOG.warn("Failed to flush journal entry: " + exc.getMessage(), exc); Metrics.JOURNAL_FLUSH_FAILURE.inc(); Iterator<FlushTicket> ticketIterator = mTicketSet.iterator(); while (ticketIterator.hasNext()) { FlushTicket ticket = ticketIterator.next(); ticketIterator.remove(); if (ticket.getTargetCounter() <= mFlushCounter.get()) { ticket.setCompleted(); } else { ticket.setError(exc); } } } } }
Source:
public String get() { if (volumeOptions == null) { volumeOptions=RO_Z; } if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path terminalPath = cheHome.resolve(TERMINAL); IoUtil.copy(Paths.get(terminalArchivePath).toFile(), terminalPath.toFile(), null, true); return getTargetOptions(terminalPath.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(terminalArchivePath); } }

Target:
public String get() { if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path terminalPath = cheHome.resolve(TERMINAL); IoUtil.copy(Paths.get(terminalArchivePath).toFile(), terminalPath.toFile(), null, true); return getTargetOptions(terminalPath.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(terminalArchivePath); } }
Source:
public static @NonNull HttpConnection getLfsContentConnection( Repository repo, Protocol.Action action, String method) throws IOException { URL contentUrl = new URL(action.href); HttpConnection contentServerConn = HttpTransport.getConnectionFactory() .create(contentUrl, HttpSupport .proxyFor(ProxySelector.getDefault(), contentUrl)); contentServerConn.setRequestMethod(method); action.header .forEach((k, v) -> contentServerConn.setRequestProperty(k, v)); if (contentUrl.getProtocol().equals("https") && !repo.getConfig().getBoolean(HttpConfig.HTTP, HttpConfig.SSL_VERIFY_KEY, true)) { HttpSupport.disableSslVerify(contentServerConn); } contentServerConn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); return contentServerConn; }

Target:
public static @NonNull HttpConnection getLfsContentConnection( Repository repo, Protocol.Action action, String method) throws IOException { URL contentUrl = new URL(action.href); HttpConnection contentServerConn = HttpTransport.getConnectionFactory() .create(contentUrl, HttpSupport .proxyFor(ProxySelector.getDefault(), contentUrl)); contentServerConn.setRequestMethod(method); action.header .forEach((k, v) -> contentServerConn.setRequestProperty(k, v)); if (contentUrl.getProtocol().equals(SCHEME_HTTPS) && !repo.getConfig().getBoolean(HttpConfig.HTTP, HttpConfig.SSL_VERIFY_KEY, true)) { HttpSupport.disableSslVerify(contentServerConn); } contentServerConn.setRequestProperty(HDR_ACCEPT_ENCODING, ENCODING_GZIP); return contentServerConn; }
Source:
public void testRefreshTokenConverter() { final String clientId = System.getenv(AAD_MULTI_TENANT_CLIENT_ID); final String clientSecret = System.getenv(AAD_MULTI_TENANT_CLIENT_SECRET); try (AppRunner app = new AppRunner(DumbApp.class)) { ChromeOptions options = new ChromeOptions(); options.addArguments("--incognito"); options.addArguments("--headless"); options.addArguments("--no-sandbox"); options.addArguments("--disable-dev-shm-usage"); WebDriver driver = new ChromeDriver(options); WebDriverWait wait = new WebDriverWait(driver, 10); app.property("azure.activedirectory.client-id", clientId); app.property("azure.activedirectory.client-secret", clientSecret); app.property("azure.activedirectory.user-group.allowed-groups", "group1,group2"); app.property("azure.activedirectory.authorization.office.scopes", "<LINK_0>"); app.start(); try { driver.get(app.root() + "api/getAccessToken"); wait.until(presenceOfElementLocated(By.name("loginfmt"))) .sendKeys(System.getenv(AAD_USER_NAME_1) + Keys.ENTER); Thread.sleep(10000); driver.findElement(By.name("passwd")) .sendKeys(System.getenv(AAD_USER_PASSWORD_1) + Keys.ENTER); Thread.sleep(10000); driver.findElement(By.cssSelector("input[type='submit']")).click(); Thread.sleep(10000); Assert.assertTrue(driver.findElement(By.tagName("body")).getText().indexOf("profile") < 0); Assert.assertTrue(driver.findElement(By.tagName("body")).getText().indexOf("<LINK_0>") >= 0); } catch (InterruptedException e) { throw new RuntimeException(e); } finally { driver.quit(); } } }

Target:
public void testRefreshTokenConverter() { try (AppRunner app = new AppRunner(DumbApp.class)) { OAuthLoginUtils.addProperty(app); app.property("azure.activedirectory.authorization.office.scopes", "<LINK_0>"); List<String> endPoints = new ArrayList<>(); endPoints.add("api/accessTokenScopes"); List<String> result = OAuthLoginUtils.get(app , endPoints); Assert.assertTrue(result.get(0).indexOf("profile") < 0); Assert.assertTrue(result.get(0).indexOf("<LINK_0>") >= 0); } }
Source:
@Override public String toString(){ return NAME; }

Target:
public String toString(){ return NAME; }
Source:
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, final CallOptions callOptions, Channel next) { return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) { private volatile boolean unauthorized = false; @Override public void start(Listener<RespT> responseListener, Metadata headers) { int timeoutSeconds = TIMEOUT_SECONDS; if (callOptions.getDeadline() != null) { long deadlineMs = callOptions.getDeadline().timeRemaining(TimeUnit.MILLISECONDS); int deadlineSeconds = (int) Math.round(deadlineMs / 1000.0); timeoutSeconds = Math.min(deadlineSeconds, timeoutSeconds); } HeaderToken token = store.getHeader(timeoutSeconds); if (!token.getStatus().isOk()) { unauthorized = true; responseListener.onClose(token.getStatus(), new Metadata()); return; } headers.put(AUTHORIZATION_HEADER_KEY, token.getHeader()); delegate().start(new UnAuthResponseListener<>(responseListener, token), headers); } @Override public void request(int numMessages) { if (!unauthorized) { delegate().request(numMessages); } } @Override public void sendMessage(ReqT message) { if (!unauthorized) { delegate().sendMessage(message); } } @Override public void halfClose() { if (!unauthorized) { delegate().halfClose(); } } @Override public void cancel(String message, Throwable cause) { if (!unauthorized) { delegate().cancel(message, cause); } } }; }

Target:
public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, final CallOptions callOptions, Channel next) { return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) { private volatile boolean unauthorized = false; @Override public void start(Listener<RespT> responseListener, Metadata headers) { long timeoutMs = -1; if (callOptions.getDeadline() != null) { timeoutMs = callOptions.getDeadline().timeRemaining(TimeUnit.MILLISECONDS); } else { timeoutMs = TimeUnit.SECONDS.toMillis(TIMEOUT_SECONDS); } HeaderToken token = store.getHeader(timeoutMs); if (!token.getStatus().isOk()) { unauthorized = true; responseListener.onClose(token.getStatus(), new Metadata()); return; } headers.put(AUTHORIZATION_HEADER_KEY, token.getHeader()); delegate().start(new UnAuthResponseListener<>(responseListener, token), headers); } @Override public void request(int numMessages) { if (!unauthorized) { delegate().request(numMessages); } } @Override public void sendMessage(ReqT message) { if (!unauthorized) { delegate().sendMessage(message); } } @Override public void halfClose() { if (!unauthorized) { delegate().halfClose(); } } @Override public void cancel(String message, Throwable cause) { if (!unauthorized) { delegate().cancel(message, cause); } } }; }
Source:
public void shouldAlertGivenFunctionInHtmlScriptElements() throws HttpMalformedHeaderException, URIException { String body = "<h1>Some text <script>Some Html Element bypassSecurityTrustHtml()</script></h1>\n" + "<b>No script here</b>\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/html;charset=ISO-8859-1"); assertTrue(msg.getResponseHeader().isText()); assertFalse(msg.getResponseHeader().isJavaScript()); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised, hasSize(1)); }

Target:
public void shouldAlertGivenFunctionInHtmlScriptElements() throws HttpMalformedHeaderException, URIException { String body = "<h1>Some text <script>Some Html Element bypassSecurityTrustHtml()</script></h1>\n" + "<b>No script here</b>\n"; HttpMessage msg = createHttpMessageWithRespBody(body, "text/html;charset=ISO-8859-1"); rule.scanHttpResponseReceive(msg, -1, createSource(msg)); assertThat(alertsRaised, hasSize(1)); assertEquals("bypassSecurityTrustHtml", alertsRaised.get(0).getEvidence()); }
Source:
public BucketFunction getBucketFunction( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle, List<Type> partitionChannelTypes, int bucketCount) { HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle; return new HiveBucketFunction(bucketCount, handle.getHiveTypes(), handle.getTypes()); }

Target:
public BucketFunction getBucketFunction( ConnectorTransactionHandle transactionHandle, ConnectorSession session, ConnectorPartitioningHandle partitioningHandle, List<Type> partitionChannelTypes, int bucketCount) { HivePartitioningHandle handle = (HivePartitioningHandle) partitioningHandle; BucketFunctionType bucketFunctionType = handle.getBucketFunctionType(); switch (bucketFunctionType) { case HIVE_COMPATIBLE: return createHiveCompatibleBucketFunction(bucketCount, handle.getHiveTypes().get()); case PRESTO_NATIVE: return createPrestoNativeBucketFunction(bucketCount, handle.getTypes().get()); default: throw new IllegalArgumentException("Unsupported bucket function type " + bucketFunctionType); } }
Source:
public PageRenderUtil( final IHTMLPage htmlPage, final User user, final PageMode mode, final long languageId, final Host site) throws DotSecurityException, DotDataException { this.site = null == site? APILocator.getHostAPI().findDefaultHost(user, mode.respectAnonPerms):site; this.pageFoundTags = Lists.newArrayList(); this.htmlPage = htmlPage; this.user = user; this.mode = mode; this.languageId=languageId; this.widgetPreExecute = new StringBuilder(); final Template template = APILocator.getHTMLPageAssetAPI().getTemplate(htmlPage, !mode.showLive); this.templateLayout = template != null && template.isDrawed() ? DotTemplateTool.themeLayout(template.getInode()) : null; this.contextMap = populateContext(); this.containersRaw = populateContainers(); }

Target:
public PageRenderUtil( final IHTMLPage htmlPage, final User user, final PageMode mode, final long languageId, final Host site) throws DotSecurityException, DotDataException { if (site == null) { this.site = APILocator.getHostAPI().findDefaultHost(user, mode.respectAnonPerms); } else { this.site = site; } this.pageFoundTags = Lists.newArrayList(); this.htmlPage = htmlPage; this.user = user; this.mode = mode; this.languageId=languageId; this.widgetPreExecute = new StringBuilder(); final Template template = APILocator.getHTMLPageAssetAPI().getTemplate(htmlPage, !mode.showLive); this.templateLayout = template != null && template.isDrawed() ? DotTemplateTool.themeLayout(template.getInode()) : null; this.contextMap = populateContext(); this.containersRaw = populateContainers(); }
Source:
public static void main(String... args) throws IOException { MockWebServer server = new MockWebServer(); server.start(); server.enqueue(new MockResponse().setBody("{\"name\": \"jason\"}")); server.enqueue(new MockResponse().setBody("<user name=\"Eximel\"/>")); Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new QualifiedTypeConverterFactory( GsonConverterFactory.create(), SimpleXmlConverterFactory.create())) .build(); Service service = retrofit.create(Service.class); User user1 = service.exampleJson().execute().body(); System.out.println("User 1: " + user1.name); User user2 = service.exampleXml().execute().body(); System.out.println("User 2: " + user2.name); server.shutdown(); }

Target:
public static void main(String... args) throws IOException { MockWebServer server = new MockWebServer(); server.start(); server.enqueue(new MockResponse().setBody("{\"name\": \"Jason\"}")); server.enqueue(new MockResponse().setBody("<user name=\"Eximel\"/>")); Retrofit retrofit = new Retrofit.Builder() .baseUrl(server.url("/")) .addConverterFactory(new QualifiedTypeConverterFactory( GsonConverterFactory.create(), SimpleXmlConverterFactory.create())) .build(); Service service = retrofit.create(Service.class); User user1 = service.exampleJson().execute().body(); System.out.println("User 1: " + user1.name); User user2 = service.exampleXml().execute().body(); System.out.println("User 2: " + user2.name); server.shutdown(); }
Source:
protected void writeRequested(ChannelPipeline pipeline, MessageEvent evt) throws Exception { if (LOGGER.isDebugEnabled()) { LOGGER.debug("writeRequested pipeline = " + pipeline + " evt = " + evt); } ChannelBuffer channelBuffer = (ChannelBuffer) evt.getMessage(); writeBuffer.writeBytes(channelBuffer); ChannelFuture writeFuture = evt.getFuture(); writeFuture.setSuccess(); }

Target:
protected void writeRequested(ChannelPipeline pipeline, MessageEvent evt) throws Exception { if (LOGGER.isDebugEnabled()) { LOGGER.debug("writeRequested pipeline = " + pipeline + " evt = " + evt); } ChannelBuffer channelBuffer = (ChannelBuffer) evt.getMessage(); FileChannel fileChannel = (FileChannel) evt.getChannel(); ChannelFuture writeFuture = evt.getFuture(); try { fileChannel.write(channelBuffer); writeFuture.setSuccess(); } catch (Throwable t) { writeFuture.setFailure(t); } }
Source:
public ModelAndView viewSequencer(@PathVariable(value = "referenceId") Long referenceId, ModelMap model) throws IOException { SequencerReference sr = requestManager.getSequencerReferenceById(referenceId); Collection<Run> runs = requestManager.listRunsBySequencerId(referenceId); Collection<SequencerServiceRecord> serviceRecords = requestManager.listSequencerServiceRecordsBySequencerId(referenceId); Collection<SequencerReference> otherSequencers = requestManager.listAllSequencerReferences(); SequencerReference sameRef = null; for (SequencerReference ref : otherSequencers) { if (ref.getId() == sr.getId()) { sameRef = ref; break; } } otherSequencers.remove(sameRef); if (sr != null) { model.put("sequencerReference", sr); model.put("sequencerRuns", runs); model.put("sequencerServiceRecords", serviceRecords); model.put("otherSequencerReferences", otherSequencers); String ip = sr.getIpAddress() == null ? "" : sr.getIpAddress().toString(); if (ip.startsWith("/")) { model.put("trimmedIpAddress", ip.substring(1)); } else { model.put("trimmedIpAddress", ip); } } else { throw new IOException("Cannot retrieve the named Sequencer reference"); } return new ModelAndView("/pages/editSequencerReference.jsp", model); }

Target:
public ModelAndView viewSequencer(@PathVariable(value = "referenceId") Long referenceId, ModelMap model) throws IOException { SequencerReference sr = requestManager.getSequencerReferenceById(referenceId); if (sr != null) { Collection<Run> runs = requestManager.listRunsBySequencerId(referenceId); Collection<SequencerServiceRecord> serviceRecords = requestManager.listSequencerServiceRecordsBySequencerId(referenceId); Collection<SequencerReference> otherSequencers = getOtherSequencers(sr.getId()); model.put(ModelKeys.SEQUENCER.getKey(), sr); model.put(ModelKeys.RUNS.getKey(), runs); model.put(ModelKeys.RECORDS.getKey(), serviceRecords); model.put(ModelKeys.OTHER_SEQUENCERS.getKey(), otherSequencers); String ip = sr.getIpAddress() == null ? "" : sr.getIpAddress().toString(); if (ip.startsWith("/")) { model.put(ModelKeys.TRIMMED_IP.getKey(), ip.substring(1)); } else { model.put(ModelKeys.TRIMMED_IP.getKey(), ip); } } else { throw new IOException("Cannot retrieve the named Sequencer reference"); } return new ModelAndView("/pages/editSequencerReference.jsp", model); }
Source:
public void init(Map<String, String> props, Schema indexingSchema, String topicName) throws Exception { checkState(props.containsKey(SCHEMA_REGISTRY_REST_URL), "Missing required property '%s'", SCHEMA_REGISTRY_REST_URL); String schemaRegistryUrl = props.get(SCHEMA_REGISTRY_REST_URL); requireNonNull(indexingSchema, "indexingSchema is null"); _sourceFieldNames = SourceFieldNameExtractor.extract(indexingSchema); SchemaRegistryClient schemaRegistryClient = new CachedSchemaRegistryClient(schemaRegistryUrl, 1000); deserializer = new KafkaAvroDeserializer(schemaRegistryClient); this.topicName = requireNonNull(topicName, "topicName is null"); this.avroRecordConverter = PluginManager.get().createInstance(AvroRecordExtractor.class.getName()); }

Target:
public void init(Map<String, String> props, Schema indexingSchema, String topicName) throws Exception { checkState(props.containsKey(SCHEMA_REGISTRY_REST_URL), "Missing required property '%s'", SCHEMA_REGISTRY_REST_URL); String schemaRegistryUrl = props.get(SCHEMA_REGISTRY_REST_URL); Preconditions.checkNotNull(indexingSchema, "Schema must be provided"); Set<String> sourceFields = SchemaFieldExtractorUtils.extract(indexingSchema); SchemaRegistryClient schemaRegistryClient = new CachedSchemaRegistryClient(schemaRegistryUrl, 1000); _deserializer = new KafkaAvroDeserializer(schemaRegistryClient); Preconditions.checkNotNull(topicName, "Topic must be provided"); _topicName = topicName; _avroRecordExtractor = PluginManager.get().createInstance(AvroRecordExtractor.class.getName()); _avroRecordExtractor.init(sourceFields, null); }
Source:
public Object getCellValue(Cell cell, EStructuralFeature eStructuralFeature) throws EMFFormsConverterException { final EAttribute eAttribute = EAttribute.class.cast(eStructuralFeature); if (cell.getCellType() == Cell.CELL_TYPE_BLANK) { return null; } if (eAttribute == null) { return null; } final EDataType attributeType = eAttribute.getEAttributeType(); if (attributeType == null) { return null; } try { return readCellValue(cell, attributeType); } catch (final IllegalStateException e) { throw new EMFFormsConverterException( String.format("Cell value of column %1$s in row %2$s on sheet %3$s must be a string.", cell.getColumnIndex() + 1, cell.getRowIndex() + 1, cell.getSheet().getSheetName()), e); } catch (final NumberFormatException e) { throw new EMFFormsConverterException( String.format("Cell value of column %1$s in row %2$s on sheet %3$s must be a string.", cell.getColumnIndex() + 1, cell.getRowIndex() + 1, cell.getSheet().getSheetName()), e); } }

Target:
public Object getCellValue(Cell cell, EStructuralFeature eStructuralFeature) throws EMFFormsConverterException { final EAttribute eAttribute = EAttribute.class.cast(eStructuralFeature); if (cell.getCellType() == Cell.CELL_TYPE_BLANK) { return null; } if (eAttribute == null) { return null; } final EDataType attributeType = eAttribute.getEAttributeType(); if (attributeType == null) { return null; } try { return readCellValue(cell, attributeType); } catch (final IllegalStateException e) { throw new EMFFormsConverterException( String.format("Cell value of column %1$s in row %2$s on sheet %3$s must be a string.", cell.getColumnIndex() + 1, cell.getRowIndex() + 1, cell.getSheet().getSheetName()), e); } catch (final NumberFormatException e) { throw new EMFFormsConverterException( String.format("Cell value of column %1$s in row %2$s on sheet %3$s is not a valud number.", cell.getColumnIndex() + 1, cell.getRowIndex() + 1, cell.getSheet().getSheetName()), e); } }
Source:
private boolean validInputs(String name, String groupType) { return (name != null) && (groupType != null); }

Target:
private boolean validInputs(String name, String groupType) { return hasText(name) && hasText(groupType); }
Source:
public String getString(int columnIndex) throws SQLException { connection.getLogger().log(Level.FINEST, " getString columnIndex: {0}", columnIndex); checkResultSet(columnIndex); if (wasNullFlag) { return null; } if (isBinary(columnIndex) && getSQLType(columnIndex) != Types.VARCHAR) { Field field = fields[columnIndex - 1]; Object obj = internalGetObject(columnIndex, field); if (obj == null) { obj = getObject(columnIndex); if (obj == null) { return null; } return getObject(columnIndex).toString(); } if (obj instanceof java.util.Date) { int oid = field.getOID(); return connection.getTimestampUtils().timeToString((java.util.Date) obj, oid == Oid.TIMESTAMPTZ || oid == Oid.TIMETZ); } if ("hstore".equals(getPGType(columnIndex))) { return HStoreConverter.toString((Map<?, ?>) obj); } return trimString(columnIndex, obj.toString()); } Encoding encoding = connection.getEncoding(); try { return trimString(columnIndex, encoding.decode(this_row[columnIndex - 1])); } catch (IOException ioe) { throw new PSQLException( GT.tr( "Invalid character data was found. This is most likely caused by stored data containing characters that are invalid for the character set the database was created in. The most common example of this is storing 8bit data in a SQL_ASCII database."), PSQLState.DATA_ERROR, ioe); } }

Target:
public String getString(int columnIndex) throws SQLException { connection.getLogger().log(Level.FINEST, " getString columnIndex: {0}", columnIndex); checkResultSet(columnIndex); if (wasNullFlag) { return null; } if (isBinary(columnIndex) && getSQLType(columnIndex) != Types.VARCHAR) { Field field = fields[columnIndex - 1]; Object obj = internalGetObject(columnIndex, field); if (obj == null) { obj = getObject(columnIndex); if (obj == null) { return null; } return obj.toString(); } if (obj instanceof java.util.Date) { int oid = field.getOID(); return connection.getTimestampUtils().timeToString((java.util.Date) obj, oid == Oid.TIMESTAMPTZ || oid == Oid.TIMETZ); } if ("hstore".equals(getPGType(columnIndex))) { return HStoreConverter.toString((Map<?, ?>) obj); } return trimString(columnIndex, obj.toString()); } Encoding encoding = connection.getEncoding(); try { return trimString(columnIndex, encoding.decode(this_row[columnIndex - 1])); } catch (IOException ioe) { throw new PSQLException( GT.tr( "Invalid character data was found. This is most likely caused by stored data containing characters that are invalid for the character set the database was created in. The most common example of this is storing 8bit data in a SQL_ASCII database."), PSQLState.DATA_ERROR, ioe); } }
Source:
public static String response(final String authHeaderAlgorithm, final String user, final String realm, final String password, final String clientPasswordAlgorithm, final String nonce, final String nc, final String cnonce, final String method, final String uri, String body, final String qop) { validate(user, realm, password, nonce, method, uri, authHeaderAlgorithm); String ha1; if (clientPasswordAlgorithm.equalsIgnoreCase(RestcommConfiguration.getInstance().getMain().getClearTextPasswordAlgorithm())) { final String a1 = A1(authHeaderAlgorithm, user, realm, password, nonce, cnonce); ha1 = H(a1, authHeaderAlgorithm); } else { ha1 = password; } final String a2 = A2(authHeaderAlgorithm, method, uri, body, qop); if (cnonce != null && qop != null && nc != null && (qop.equalsIgnoreCase("auth") || qop.equalsIgnoreCase("auth-int"))) { return KD(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + H(a2, authHeaderAlgorithm), authHeaderAlgorithm); } else { return KD(ha1, nonce + ":" + H(a2, authHeaderAlgorithm), authHeaderAlgorithm); } }

Target:
public static String response(final String authHeaderAlgorithm, final String user, final String realm, final String password, final String clientPasswordAlgorithm, final String nonce, final String nc, final String cnonce, final String method, final String uri, String body, final String qop) { validate(user, realm, password, nonce, method, uri, authHeaderAlgorithm); String ha1; if (clientPasswordAlgorithm.equalsIgnoreCase("cleartext")) { final String a1 = A1(authHeaderAlgorithm, user, realm, password, nonce, cnonce); ha1 = H(a1, authHeaderAlgorithm); } else { ha1 = password; } final String a2 = A2(authHeaderAlgorithm, method, uri, body, qop); if (cnonce != null && qop != null && nc != null && (qop.equalsIgnoreCase("auth") || qop.equalsIgnoreCase("auth-int"))) { return KD(ha1, nonce + ":" + nc + ":" + cnonce + ":" + qop + ":" + H(a2, authHeaderAlgorithm), authHeaderAlgorithm); } else { return KD(ha1, nonce + ":" + H(a2, authHeaderAlgorithm), authHeaderAlgorithm); } }
Source:
private void addSenderUserPhotoLinkIfAvailable(MessageDto message) { if (message.getSenderUserPhotoId().isPresent()) { message.add( UserPhotoController.getUserPhotoLinkBuilder(message.getSenderUserPhotoId().get()).withRel("userPhoto")); } }

Target:
private void addSenderUserPhotoLinkIfAvailable(MessageDto message) { message.getSenderUserPhotoId().ifPresent( userPhotoId -> message.add(UserPhotoController.getUserPhotoLinkBuilder(userPhotoId).withRel("userPhoto"))); }
Source:
protected void executeIrsBrokerCommand() { StorageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId()); setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); String imageInitSize = null; if (getParameters().getImageInitialSizeInBytes() != 0) { imageInitSize = Long.valueOf(getParameters().getImageInitialSizeInBytes()).toString(); } uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), 2, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString(), imageInitSize); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.uuid); createdImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(createdImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId())); }

Target:
protected void executeIrsBrokerCommand() { StorageDomainHelper.checkNumberOfLVsForBlockDomain(getParameters().getStorageDomainId()); setReturnValue(Guid.Empty); log.info("-- executeIrsBrokerCommand: calling 'createVolume' with two new parameters: description and UUID"); String imageInitSize = null; if (getParameters().getImageInitialSizeInBytes() != 0) { imageInitSize = String.valueOf(getParameters().getImageInitialSizeInBytes()); } uuidReturn = getIrsProxy().createVolume(getParameters().getStorageDomainId().toString(), getParameters().getStoragePoolId().toString(), getParameters().getImageGroupId().toString(), Long.valueOf(getParameters().getImageSizeInBytes()).toString(), getParameters().getVolumeFormat().getValue(), getParameters().getImageType().getValue(), 2, getParameters().getNewImageID().toString(), getParameters().getNewImageDescription(), getParameters().getSourceImageGroupId().toString(), getParameters().getImageId().toString(), imageInitSize); proceedProxyReturnValue(); Guid taskID = new Guid(uuidReturn.uuid); createdImageId = getParameters().getNewImageID().toString(); setReturnValue(new Guid(createdImageId)); getVDSReturnValue().setCreationInfo( new AsyncTaskCreationInfo(taskID, AsyncTaskType.createVolume, getParameters().getStoragePoolId())); }
Source:
public void handleRequest(HttpServerExchange exchange) throws Exception { exchange.getResponseSender().send(exchange.getSourceAddress() + "|" + exchange.getRequestScheme() + "|" + exchange.getDestinationAddress()); next.handleRequest(exchange); }

Target:
public void handleRequest(HttpServerExchange exchange) throws Exception { String value = exchange.getSourceAddress() + "|" + exchange.getRequestScheme() + "|" + exchange.getDestinationAddress(); exchange.getResponseHeaders().put(new HttpString(FORWARD_TEST_HEADER), value); next.handleRequest(exchange); }
Source:
public double getPercentCopied() { if (pathInfo == null) { return -1; } if(pathInfo.getTotalSize() == 0) { return 0.0; } else { return (double) (totalBytesTransferred * 100) / (double) pathInfo.getTotalSize(); } }

Target:
public double getPercentCopied() { if (pathInfo == null) { return -1.0; } if(pathInfo.getTotalSize() == 0) { return 0.0; } else { return (double) (totalBytesTransferred * 100) / (double) pathInfo.getTotalSize(); } }
Source:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community").build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1).build(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/items/" + item.getID(), expectedStatus); }

Target:
private void runPatchMetadataTests(EPerson asUser, int expectedStatus) throws Exception { context.turnOffAuthorisationSystem(); parentCommunity = CommunityBuilder.createCommunity(context).withName("Parent Community").build(); Community child1 = CommunityBuilder.createSubCommunity(context, parentCommunity) .withName("Sub Community").build(); Collection col1 = CollectionBuilder.createCollection(context, child1).withName("Collection 1").build(); Item item = ItemBuilder.createItem(context, col1).build(); context.restoreAuthSystemState(); String token = getAuthToken(asUser.getEmail(), password); new MetadataPatchSuite().runWith(getClient(token), "/api/core/items/" + item.getID(), expectedStatus); }
Source:
public ParquetProperties(int dictPageSize, WriterVersion writerVersion, boolean enableDict, ByteBufferAllocator allocator) { this.dictionaryPageSizeThreshold = dictPageSize; this.writerVersion = writerVersion; this.enableDictionary = enableDict; this.allocator = allocator != null ? allocator : new HeapByteBufferAllocator(); }

Target:
public ParquetProperties(int dictPageSize, WriterVersion writerVersion, boolean enableDict, ByteBufferAllocator allocator) { this.dictionaryPageSizeThreshold = dictPageSize; this.writerVersion = writerVersion; this.enableDictionary = enableDict; Preconditions.checkNotNull(allocator, "ByteBufferAllocator"); this.allocator = allocator; }
Source:
public void run() { String command = null; while (running) { try { if (color) { command = reader.readLine(colorize(ChatColor.RESET.toString()) + CONSOLE_PROMPT); } else { command = reader.readLine(CONSOLE_PROMPT); } if (command != null && !(command = command.trim()).isEmpty()) { reader.getTerminal().writer().println(colorize(ChatColor.RESET + "====" + ChatColor.GOLD + "g>" + ChatColor.RESET + '"' + command + '"')); if (command.startsWith("$")) { server.getScheduler().runTask(null, new EvalTask(command.substring(1), command.startsWith("$$"))); } else if (command.startsWith("!")) { server.getScheduler() .runTask(null, new ConsoleTask(command.substring(1))); } else { server.getScheduler().runTask(null, new CommandTask(command)); } } } catch (CommandException ex) { LocalizedStrings.Console.Error.Manager.COMMAND.log(ex, command); } catch (Exception ex) { LocalizedStrings.Console.Error.Manager.COMMAND_READ.log(ex); } } }

Target:
public void run() { String command = null; while (running) { try { if (color) { command = reader.readLine(colorize(ChatColor.RESET.toString()) + CONSOLE_PROMPT); } else { command = reader.readLine(CONSOLE_PROMPT); } if (command != null && !(command = command.trim()).isEmpty()) { reader.getTerminal().writer().println(colorize(String.format( "%s====%sg>%s\"%s\"", ChatColor.RESET, ChatColor.GOLD, ChatColor.RESET, command))); server.getScheduler().runTask(null, new CommandTask(command)); } } catch (CommandException ex) { ConsoleMessages.Warn.Manager.COMMAND.log(ex, command); } catch (Exception ex) { ConsoleMessages.Error.Manager.COMMAND_READ.log(ex); } } }