auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public String httpGet(String url) { String domain = getResources().getString(R.string.ais_domain); String result = ""; CookieStore cookieStore = new BasicCookieStore(); BasicHttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); if(!authorizationCookie.equals("")) { String[] cookies = authorizationCookie.split(";"); for (int i = 0; i < cookies.length; i++) { String[] nvp = cookies[i].split("="); BasicClientCookie c = new BasicClientCookie(nvp[0], nvp[1]); c.setDomain(domain); cookieStore.addCookie(c); } } HttpResponse httpResponse = httpClient.execute(httpGet, localContext); result = EntityUtils.toString(httpResponse.getEntity()); } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage()); } return result; }

Target:
public String httpGet(String url) { String domain = getResources().getString(R.string.ais_domain); String result = ""; CookieStore cookieStore = new BasicCookieStore(); BasicHttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(url); if(!authorizationCookie.equals("")) { String[] cookies = authorizationCookie.split(";"); for (int i = 0; i < cookies.length; i++) { String[] kvp = cookies[i].split("="); if(kvp.length != 2) { throw new Exception("Illegal cookie: missing key/value pair."); } BasicClientCookie c = new BasicClientCookie(kvp[0], kvp[1]); c.setDomain(domain); cookieStore.addCookie(c); } } HttpResponse httpResponse = httpClient.execute(httpGet, localContext); result = EntityUtils.toString(httpResponse.getEntity()); } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage()); } return result; }
Source:
public void start() throws SlickException { try { runSetup(); getDelta(); while (running()) gameLoop(); } catch (Exception e) { this.e = e; } try { close_sub(); } catch (Exception e) { if (this.e == null) this.e = e; } destroy(); if (e != null) { CrashReport report = new CrashReport(null, e); CrashInfo info = new CrashInfo("Game Engine Details"); info.addSectionSafe("State Info", new Callable<String>() { public String call() throws Exception { StateBasedGame sbg = (StateBasedGame)game; return sbg.getCurrentStateID() + " - " + sbg.getCurrentState().getClass().getSimpleName(); } }); info.addSection("OpenGL software mode", isSoftwareMode()); report.addCrashInfo(info); ErrorHandler.error(report, true); e = null; forceExit = true; } if (forceExit) { Opsu.close(); System.exit(-1); } }

Target:
public void start() throws SlickException { try { runSetup(); getDelta(); while (running()) gameLoop(); } catch (Exception e) { this.e = e; } try { close_sub(); } catch (Exception e) { if (this.e == null) this.e = e; } destroy(); if (e != null) { ErrorHandler.error(null, e, true); e = null; forceExit = true; } if (forceExit) { Opsu.close(); System.exit((e == null) ? 0 : 1); } }
Source:
public void testIrisDataFetcher() throws Exception { MnistFetcher mnistFetcher = new MnistFetcher(); mnistFetcher.downloadAndUntar(); }

Target:
public void testIrisDataFetcher() throws Exception { MnistFetcher mnistFetcher = new MnistFetcher(); File mnistDir = mnistFetcher.downloadAndUntar(); assert(mnistDir.isDirectory()); }
Source:
public Builder cmd(final List<String> cmd) { if (cmd != null && !cmd.isEmpty()) { this.cmd = new ArrayList<String>(cmd); } return this; }

Target:
public Builder cmd(final List<String> cmd) { this.cmd = cmd; return this; }
Source:
private boolean isIsoVersionCompatible(String isoFile) { boolean retValue = true; VdsDynamic vdsDynamic = getVdsDynamicDAO().get(getVdsId()); try { RpmVersion vdsOsVersion = new RpmVersion(vdsDynamic.gethost_os(), "RHEV Hypervisor -", true); RpmVersion isoVersion = new RpmVersion(isoFile, Config.<String> GetValue(ConfigValues.OvirtIsoPrefix), true); if (isoVersion.getMajor() != vdsOsVersion.getMajor() && vdsOsVersion.getMajor() != -1 && isoVersion.getMajor() != -1) { retValue = false; } } catch (RuntimeException e) { log.errorFormat("Failed to parse iso version {0} or ovirt os version {1} with error {2}", vdsDynamic.gethost_os(), isoFile, ExceptionUtils.getMessage(e)); } return retValue; }

Target:
private boolean isIsoVersionCompatible(String isoFile) { boolean retValue = true; VdsDynamic vdsDynamic = getVdsDynamicDAO().get(getVdsId()); try { RpmVersion vdsOsVersion = new RpmVersion(vdsDynamic.gethost_os(), "RHEV Hypervisor -", true); RpmVersion isoVersion = new RpmVersion(isoFile, Config.<String> GetValue(ConfigValues.OvirtIsoPrefix), true); if (isoVersion.getMajor() != vdsOsVersion.getMajor() && vdsOsVersion.getMajor() != -1 && isoVersion.getMajor() != -1) { retValue = false; } } catch (RuntimeException e) { log.warnFormat("Failed to parse iso version {0} or ovirt os version {1} with error {2}", isoFile, vdsDynamic.gethost_os(), ExceptionUtils.getMessage(e)); } return retValue; }
Source:
public static Optional<TraceState> getTrace() { Deque<TraceState> stack = STATE.get(); return (!stack.isEmpty()) ? Optional.of(stack.peek()) : Optional.<TraceState>absent(); }

Target:
public static Optional<TraceState> getTrace() { Deque<TraceState> stack = STATE.get(); return stack.isEmpty() ? Optional.<TraceState>absent() : Optional.of(stack.peek()); }
Source:
public void execute(@Observes InterceptorsExecuted event) { try { ControllerMethod method = event.getControllerMethod(); methodReady.fire(new MethodReady(method)); Method reflectionMethod = method .getMethod(); Object[] parameters = methodInfo.getParametersValues(); log.debug("Invoking {}", reflectionMethod); Object instance = event.getControllerInstance(); Object result = new Mirror().on(instance).invoke().method(reflectionMethod).withArgs(parameters); if (validator.hasErrors()) { if (log.isDebugEnabled()) { try { validator.onErrorUse(nothing()); } catch (ValidationException e) { log.debug("Some validation errors occured: {}", e.getErrors()); } } throw new InterceptionException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } this.methodInfo.setResult(result); methodExecutedEvent.fire(new MethodExecuted(method, methodInfo)); } catch (IllegalArgumentException e) { throw new InterceptionException(e); } catch (ReflectionProviderException e) { throwIfNotValidationException(e, new ApplicationLogicException(e.getCause())); } catch (Exception e) { throwIfNotValidationException(e, new ApplicationLogicException(e)); } }

Target:
public void execute(@Observes InterceptorsExecuted event) { try { ControllerMethod method = event.getControllerMethod(); methodReady.fire(new MethodReady(method)); Method reflectionMethod = method .getMethod(); Object[] parameters = methodInfo.getParametersValues(); log.debug("Invoking {}", reflectionMethod); Object instance = event.getControllerInstance(); Object result = new Mirror().on(instance).invoke().method(reflectionMethod).withArgs(parameters); if (validator.hasErrors()) { if (log.isDebugEnabled()) { try { validator.onErrorUse(nothing()); } catch (ValidationException e) { log.debug("Some validation errors occured: {}", e.getErrors()); } } throw new InterceptionException( "There are validation errors and you forgot to specify where to go. Please add in your method " + "something like:\n" + "validator.onErrorUse(page()).of(AnyController.class).anyMethod();\n" + "or any view that you like.\n" + "If you didn't add any validation error, it is possible that a conversion error had happened."); } this.methodInfo.setResult(result); methodExecutedEvent.fire(new MethodExecuted(method, methodInfo)); } catch (IllegalArgumentException e) { throw new InterceptionException(e); } catch (ReflectionProviderException e) { throwIfNotValidationException(e, e.getCause()); } catch (Exception e) { throwIfNotValidationException(e, e); } }
Source:
protected void addSkuToCart(Sku sku, OrderItemRequestDTO orderItemRequestDTO, Product product, CartOperationRequest request) throws InventoryUnavailableException{ if (!hasSkuOrIsNonDiscreteOI(sku, orderItemRequestDTO)) { handleIfNoSku(orderItemRequestDTO, product); } else if (sku == null) { handleIfNonDiscreteOI(orderItemRequestDTO); } else if (!sku.isActive()) { throw new InventoryUnavailableException("Sku is not Active"); } else { request.getItemRequest().setSkuId(sku.getId()); } }

Target:
protected void addSkuToCart(Sku sku, OrderItemRequestDTO orderItemRequestDTO, Product product, CartOperationRequest request) throws InventoryUnavailableException{ if (!hasSkuOrIsNonDiscreteOI(sku, orderItemRequestDTO)) { handleIfNoSku(orderItemRequestDTO, product); } else if (sku == null) { handleIfNonDiscreteOI(orderItemRequestDTO); } else if (!sku.isActive()) { throw new SkuNotActiveException("Sku is not Active"); } else { request.getItemRequest().setSkuId(sku.getId()); } }
Source:
public static int CompareVariantContextToLocus(final SAMSequenceDictionary dictionary, final VariantContext variantContext, final Locus locus) { final int indexDiff = dictionary.getSequenceIndex(variantContext.getContig()) - locus.getSequenceIndex(); if (indexDiff != 0) { return indexDiff < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE; } if (locus.getPosition() < variantContext.getStart()) return variantContext.getStart() - locus.getPosition(); if (locus.getPosition() > variantContext.getEnd()) return variantContext.getEnd() - locus.getPosition(); return 0; }

Target:
public static int CompareVariantContextToLocus(final SAMSequenceDictionary dictionary, final VariantContext variantContext, final Locus locus) { final int indexDiff = dictionary.getSequenceIndex(variantContext.getContig()) - locus.getSequenceIndex(); if (indexDiff != 0) { return indexDiff < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE; } if (locus.getPosition() < variantContext.getStart()) { return variantContext.getStart() - locus.getPosition(); } if (locus.getPosition() > variantContext.getEnd()) { return variantContext.getEnd() - locus.getPosition(); } return 0; }
Source:
private void fatalError(final int status, final String msg) { String err = Errors.getErrorMessage(status); this.logger.error("Fatal Error: " + status + (err == null ? " " : err)); if (msg != null) { this.logger.error(msg); } }

Target:
private void fatalError(final int status, final String msg) { String err = Errors.getErrorMessage(status); this.logger.warn("ISY Fatal Error: {}", status, (err == null ? " " : err), (msg == null ? " " : msg) ); }
Source:
public List<DocumentModel> getComments(CoreSession session, DocumentModel docModel) throws CommentSecurityException { if (session.exists(docModel.getRef()) && !session.hasPermission(docModel.getRef(), SecurityConstants.READ)) { throw new CommentSecurityException("The user " + session.getPrincipal().getName() + " does not have access to the comments of document " + docModel.getId()); } PageProviderService ppService = Framework.getService(PageProviderService.class); Map<String, Serializable> props = Collections.singletonMap(CORE_SESSION_PROPERTY, (Serializable) session); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) ppService.getPageProvider( GET_COMMENTS_FOR_DOC_PAGEPROVIDER_NAME, singletonList(new SortInfo(COMMENT_CREATION_DATE, true)), null, null, props, docModel.getId()); return pageProvider.getCurrentPage(); }

Target:
public List<DocumentModel> getComments(CoreSession session, DocumentModel docModel) throws CommentSecurityException { if (session.exists(docModel.getRef()) && !session.hasPermission(docModel.getRef(), SecurityConstants.READ)) { throw new CommentSecurityException("The user " + session.getPrincipal().getName() + " does not have access to the comments of document " + docModel.getId()); } PageProviderService ppService = Framework.getService(PageProviderService.class); return CoreInstance.doPrivileged(session, s -> { Map<String, Serializable> props = Collections.singletonMap(CORE_SESSION_PROPERTY, (Serializable) s); PageProvider<DocumentModel> pageProvider = (PageProvider<DocumentModel>) ppService.getPageProvider( GET_COMMENTS_FOR_DOC_PAGEPROVIDER_NAME, singletonList(new SortInfo(COMMENT_CREATION_DATE, true)), null, null, props, docModel.getId()); return pageProvider.getCurrentPage(); }); }
Source:
public static void main(String[] args) throws InterruptedException { Configuration configuration = new Configuration(args); Set<String> registers = configuration.getRegisters(); ScheduledExecutorService executorService = Executors.newScheduledThreadPool( (int) registers.stream().filter(r -> configuration.cloudSearchEndPoint(r).isPresent() || configuration.elasticSearchEndPoint(r).isPresent()).count() + 2 * registers.size() ); List<Indexer> indexers = registers.stream().map(r -> new Indexer(configuration, r)).collect(Collectors.toList()); addShutdownHook(executorService, indexers); indexers.stream().parallel().forEach(indexer -> indexer.start(executorService)); Thread.currentThread().join(); }

Target:
public static void main(String[] args) throws InterruptedException { Configuration configuration = new Configuration(args); Set<String> registers = configuration.getRegisters(); ScheduledExecutorService executorService = Executors.newScheduledThreadPool(getCorePoolSize(configuration, registers)); List<Indexer> indexers = registers.stream().map(r -> new Indexer(configuration, r)).collect(Collectors.toList()); addShutdownHook(executorService, indexers); indexers.stream().parallel().forEach(indexer -> indexer.start(executorService)); Thread.currentThread().join(); }
Source:
public Tokenizer create(String toTokenize) { if (toTokenize.isEmpty()) { throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize"); } JapaneseTokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm); if (preProcessor != null) { t.setTokenPreProcessor(preProcessor); } return t; }

Target:
public Tokenizer create(String toTokenize) { if (toTokenize.isEmpty()) { throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize"); } Tokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm); if (preProcessor != null) { t.setTokenPreProcessor(preProcessor); } return t; }
Source:
private VillagerCareer init(EntityVillager.ITradeList[][] traids) { for(int i = 0; i<traids.length; i++) { ArrayList<ITradeList> tradesForLevel = new ArrayList<ITradeList>(); for(ITradeList trade: traids[i]) { tradesForLevel.add(trade); } levelTrades.put(i, tradesForLevel); } return this; }

Target:
private VillagerCareer init(EntityVillager.ITradeList[][] traids) { for(int i = 0; i<traids.length; i++) { ArrayList<ITradeList> tradesForLevel = Lists.newArrayList(traids[i]); levelTrades.put(i, tradesForLevel); } return this; }
Source:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_list, menu); MenuItem shareItem = menu.findItem(R.id.menu_share); shareItem.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title); ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); mShareIntent = new Intent(); mShareIntent.setAction(Intent.ACTION_SEND); mShareIntent.setType("text/plain"); mShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, mLog.getText()); actionProvider.setShareIntent(mShareIntent); return true; }

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_list, menu); MenuItem switchLog = menu.findItem(R.id.switch_logs); switchLog.setTitle(mSyncthingLog ? R.string.log_android_title : R.string.log_syncthing_title); MenuItem shareItem = menu.findItem(R.id.menu_share); ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem); mShareIntent = new Intent(); mShareIntent.setAction(Intent.ACTION_SEND); mShareIntent.setType("text/plain"); mShareIntent.putExtra(android.content.Intent.EXTRA_TEXT, mLog.getText()); actionProvider.setShareIntent(mShareIntent); return true; }
Source:
public Builder setPrincipalDecoder(PrincipalDecoder principalDecoder) { Assert.checkNotNullParam("roleMapper", roleMapper); assertNotBuilt(); this.principalDecoder = principalDecoder; return this; }

Target:
public Builder setPrincipalDecoder(PrincipalDecoder principalDecoder) { Assert.checkNotNullParam("principalDecoder", principalDecoder); assertNotBuilt(); this.principalDecoder = principalDecoder; return this; }
Source:
public Vector<T> prependAll(java.lang.Iterable<? extends T> elements) { List<T> list = List.ofAll(elements); final int newIndexShift = indexShift - list.length(); HashArrayMappedTrie<Integer, T> newTrie = trie; for (int i = 0; !list.isEmpty(); i++) { newTrie = newTrie.put(newIndexShift + i, list.head()); list = list.tail(); } return new Vector<>(newIndexShift, newTrie); }

Target:
public Vector<T> prependAll(java.lang.Iterable<? extends T> elements) { List<T> list = List.ofAll(elements); final int newIndexShift = indexShift - list.length(); HashArrayMappedTrie<Integer, T> newTrie = trie; for (int i = newIndexShift; !list.isEmpty(); i++) { newTrie = newTrie.put(i, list.head()); list = list.tail(); } return new Vector<>(newIndexShift, newTrie); }
Source:
public String getConfigurationUrl() { String httpPolicy = yarnConfiguration.get(TaskFactory.YARN_HTTP_POLICY); String address = StringUtils.EMPTY; if (httpPolicy != null && httpPolicy.equals(TaskFactory.YARN_HTTP_POLICY_HTTPS_ONLY)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_HTTPS_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8090"; } } else { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8088"; } } return "http://" + address + "/yarnConfiguration"; }

Target:
public String getConfigurationUrl() { String httpPolicy = yarnConfiguration.get(TaskFactory.YARN_HTTP_POLICY); String address = StringUtils.EMPTY; if (httpPolicy != null && httpPolicy.equals(TaskFactory.YARN_HTTP_POLICY_HTTPS_ONLY)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_HTTPS_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8090"; } return "https://" + address + "/yarnConfiguration"; } else { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_WEBAPP_ADDRESS); if (StringUtils.isEmpty(address)) { address = yarnConfiguration.get(TaskFactory.YARN_RESOURCEMANAGER_HOSTNAME) + ":8088"; } return "http://" + address + "/yarnConfiguration"; } }
Source:
public IntegrationFlow serverOut(AbstractServerConnectionFactory server) { return IntegrationFlows.from(() -> "seed", e -> e.poller(Pollers.fixedDelay(5000))) .split(new AbstractMessageSplitter() { @Override protected Object splitMessage(Message<?> message) { return ServerPeer.this.clients.iterator(); } }) .enrichHeaders(h -> h.headerExpression(IpHeaders.CONNECTION_ID, "payload")) .transform(p -> "Hello from server") .handle(Tcp.outboundAdapter(server)) .get(); }

Target:
public IntegrationFlow serverOut(AbstractServerConnectionFactory server) { return IntegrationFlows.from(() -> "seed", e -> e.poller(Pollers.fixedDelay(5000))) .split(this.clients, "iterator") .enrichHeaders(h -> h.headerExpression(IpHeaders.CONNECTION_ID, "payload")) .transform(p -> "Hello from server") .handle(Tcp.outboundAdapter(server)) .get(); }
Source:
List<Long> evaluate(long dataSourceId) throws ExportRulesException { try { SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase(); ResultSet resultSet = null; try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId))) { resultSet = queryResult.getResultSet(); List<Long> fileIds = new ArrayList<>(); while (resultSet.next()) { fileIds.add(resultSet.getLong("obj_id")); } return fileIds; } finally { if (resultSet != null) { resultSet.close(); } } } catch (NoCurrentCaseException ex) { throw new ExportRulesException("No current case", ex); } catch (TskCoreException ex) { throw new ExportRulesException("Error querying case database", ex); } catch (SQLException ex) { throw new ExportRulesException("Error processing result set", ex); } }

Target:
List<Long> evaluate(long dataSourceId) throws ExportRulesException { try { SleuthkitCase db = Case.getCurrentCaseThrows().getSleuthkitCase(); try (SleuthkitCase.CaseDbQuery queryResult = db.executeQuery(getQuery(dataSourceId)); ResultSet resultSet = queryResult.getResultSet();) { List<Long> fileIds = new ArrayList<>(); while (resultSet.next()) { fileIds.add(resultSet.getLong("obj_id")); } return fileIds; } } catch (NoCurrentCaseException ex) { throw new ExportRulesException("No current case", ex); } catch (TskCoreException ex) { throw new ExportRulesException("Error querying case database", ex); } catch (SQLException ex) { throw new ExportRulesException("Error processing result set", ex); } }
Source:
public Object execute(final ExecutionEvent event) { final ImageBuild wizard = new ImageBuild(); final WizardDialog wizardDialog = new NonModalWizardDialog(HandlerUtil.getActiveShell(event), wizard); wizardDialog.create(); IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage activePage = null; IWorkbenchPart activePart = null; if (window != null) activePage = window.getActivePage(); if (activePage != null) activePart = activePage.getActivePart(); connection = CommandUtils.getCurrentConnection(activePart); if (connection == null) { IDockerConnection[] connections = DockerConnectionManager .getInstance().getConnections(); if (connections.length > 0) connection = connections[0]; } if (connection == null || connection.getState() != EnumDockerConnectionState.ESTABLISHED) { Display.getDefault().syncExec(() -> MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(), WizardMessages.getString("ErrorNoActiveConnection.msg"), WizardMessages.getString("ErrorNoActiveConnection.desc"))); return null; } final boolean buildImage = wizardDialog.open() == Window.OK; if (buildImage) { performBuildImage(wizard); } return null; }

Target:
public Object execute(final ExecutionEvent event) { final ImageBuild wizard = new ImageBuild(); final WizardDialog wizardDialog = new NonModalWizardDialog(HandlerUtil.getActiveShell(event), wizard); wizardDialog.create(); IWorkbenchWindow window = PlatformUI.getWorkbench() .getActiveWorkbenchWindow(); IWorkbenchPage activePage = null; IWorkbenchPart activePart = null; if (window != null) activePage = window.getActivePage(); if (activePage != null) activePart = activePage.getActivePart(); connection = CommandUtils.getCurrentConnection(activePart); if (connection == null) { IDockerConnection[] connections = DockerConnectionManager .getInstance().getConnections(); if (connections.length > 0) connection = connections[0]; } if (connection == null || connection.isOpen()) { Display.getDefault().syncExec(() -> MessageDialog.openError( PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(), WizardMessages.getString("ErrorNoActiveConnection.msg"), WizardMessages.getString("ErrorNoActiveConnection.desc"))); return null; } final boolean buildImage = wizardDialog.open() == Window.OK; if (buildImage) { performBuildImage(wizard); } return null; }
Source:
byte[] getCachedBytes(RevObject obj, ObjectLoader ldr) throws LargeObjectException, MissingObjectException, IOException { try { return ldr.getCachedBytes(streamFileThreshold); } catch (LargeObjectException tooBig) { tooBig.setObjectId(obj); throw tooBig; } }

Target:
byte[] getCachedBytes(RevObject obj, ObjectLoader ldr) throws LargeObjectException, MissingObjectException, IOException { try { return ldr.getCachedBytes(); } catch (LargeObjectException tooBig) { tooBig.setObjectId(obj); throw tooBig; } }
Source:
protected Session doCreateSession( SessionContext context ) { Session session; if( WebUtils.isHttp( context ) ) { session = newSessionInstance( context ); if ( log.isTraceEnabled() ) { log.trace( "Creating session for host {}", session.getHost() ); } HttpServletRequest request = WebUtils.getHttpRequest( context ); if ( isStatelessClient( request ) ) { ( (SimpleSession) session ).setId( fakeSessionIdGenerator.generateId( session ) ); log.debug( "Stateless client session is not persisted.", session.getId() ); session.setAttribute( DO_NOT_STORE_SESSION_KEY, Boolean.TRUE ); } else { create( session ); } if ( log.isTraceEnabled() ) { log.trace( "Session was created for User-Agent {}", session.getId(), getUserAgent( request ) ); } } else { log.trace( "Non http request, falling back to default implemenation." ); session = super.doCreateSession( context ); } return session; }

Target:
protected Session doCreateSession( SessionContext context ) { Session session; if( WebUtils.isHttp( context ) ) { session = newSessionInstance( context ); if ( log.isTraceEnabled() ) { log.trace( "Creating session for host {}", session.getHost() ); } HttpServletRequest request = WebUtils.getHttpRequest( context ); if ( isStatelessClient( request ) ) { ( (SimpleSession) session ).setId( fakeSessionIdGenerator.generateId( session ) ); log.debug( "Stateless client session is not persisted.", session.getId() ); session.setAttribute( DO_NOT_STORE_SESSION_KEY, Boolean.TRUE ); } else { create( session ); } if ( log.isTraceEnabled() ) { log.trace( "Session was created for User-Agent {}", session.getId(), getUserAgent( request ) ); } } else { log.trace( "Non http request, falling back to default implementation." ); session = super.doCreateSession( context ); } return session; }
Source:
public TableMetadata withDataColumns(List<Column> dataColumns) { return new TableMetadata( owner, tableType, dataColumns, partitionColumns, parameters, storageFormat, bucketProperty, Optional.of(preferredOrderingColumns), serdeParameters, externalLocation, viewOriginalText, viewExpandedText, columnStatistics); }

Target:
public TableMetadata withDataColumns(List<Column> dataColumns) { return new TableMetadata( owner, tableType, dataColumns, partitionColumns, parameters, storageFormat, bucketProperty, storageParameters, serdeParameters, externalLocation, viewOriginalText, viewExpandedText, columnStatistics); }
Source:
SshLog(final Provider<SshSession> session, final Provider<Context> context, final SitePaths site, @GerritServerConfig Config config, AuditService auditService) { this.session = session; this.context = context; this.auditService = auditService; if (config.getBoolean("sshd", "requestlog", true)) { final DailyRollingFileAppender dst = new DailyRollingFileAppender(); dst.setName(LOG_NAME); dst.setLayout(new MyLayout()); dst.setEncoding("UTF-8"); dst.setFile(new File(resolve(site.logs_dir), LOG_NAME).getPath()); dst.setImmediateFlush(true); dst.setAppend(true); dst.setThreshold(Level.INFO); dst.setErrorHandler(new DieErrorHandler()); dst.activateOptions(); dst.setErrorHandler(new LogLogHandler()); async = new AsyncAppender(); async.setBlocking(true); async.setBufferSize(config.getInt("core", "asyncLoggingBufferSize", 64)); async.setLocationInfo(false); async.addAppender(dst); async.activateOptions(); } else { async = null; } }

Target:
SshLog(final Provider<SshSession> session, final Provider<Context> context, final SitePaths site, @GerritServerConfig Config config, AuditService auditService) { this.session = session; this.context = context; this.auditService = auditService; if (config.getBoolean("sshd", "requestLog", true)) { final DailyRollingFileAppender dst = new DailyRollingFileAppender(); dst.setName(LOG_NAME); dst.setLayout(new MyLayout()); dst.setEncoding("UTF-8"); dst.setFile(new File(resolve(site.logs_dir), LOG_NAME).getPath()); dst.setImmediateFlush(true); dst.setAppend(true); dst.setThreshold(Level.INFO); dst.setErrorHandler(new DieErrorHandler()); dst.activateOptions(); dst.setErrorHandler(new LogLogHandler()); async = new AsyncAppender(); async.setBlocking(true); async.setBufferSize(config.getInt("core", "asyncLoggingBufferSize", 64)); async.setLocationInfo(false); async.addAppender(dst); async.activateOptions(); } else { async = null; } }
Source:
public MagicCommandFunctionality addImport() { return (code, command, message, executionCount) -> { String[] parts = command.split(" "); if (parts.length != 2) { return sendErrorMessage(message, "Wrong import format.", executionCount); } if (isValidImport(parts[1], executionCount)) { this.kernel.addImport(new ImportPath(parts[1])); return getMagicCommandItem(code, message, executionCount); } return sendErrorMessage(message, "Provided import doesn't exists. \n" + "Try firstly add jar which contains class to classpath.", executionCount); }; }

Target:
public MagicCommandFunctionality addImport() { return (code, command, message, executionCount) -> { String[] parts = command.split(" "); if (parts.length != 2) { return createResultWithCustomMessage(kernel.getImports().toString(), message, executionCount); } this.kernel.addImport(new ImportPath(parts[1])); if (isValidImport(parts[1], executionCount)) { return getMagicCommandItem(code, message, executionCount); } this.kernel.removeImport(new ImportPath(parts[1])); return sendErrorMessage(message, "Could not import " + parts[1] + ", class not found.", executionCount); }; }
Source:
void updateVolumeHostInfo(AllocationAttempt attempt, AllocationCandidate candidate, Long newHost) { List<Object> storageDriverIds = new ArrayList<>(); for (Volume v : attempt.getVolumes()) { if (v.getStorageDriverId() != null) { storageDriverIds.add(v.getStorageDriverId()); } } Map<Object, Object> criteria = new HashMap<Object, Object>(); criteria.put(STORAGE_DRIVER.REMOVED, new io.github.ibuildthecloud.gdapi.condition.Condition(ConditionType.NULL)); criteria.put(STORAGE_DRIVER.ID, new io.github.ibuildthecloud.gdapi.condition.Condition(ConditionType.IN, storageDriverIds)); List<StorageDriver> drivers = objectManager.find(StorageDriver.class, criteria); Map<Long, StorageDriver> storageDrivers = new HashMap<>(); for (StorageDriver d : drivers) { storageDrivers.put(d.getId(), d); } for (Volume v : attempt.getVolumes()) { boolean persist = false; StorageDriver d = v.getStorageDriverId() != null ? storageDrivers.get(v.getStorageDriverId()) : null; if (d != null && StorageDriverConstants.SCOPE_LOCAL.equals(DataAccessor.fieldString(d, StorageDriverConstants.FIELD_SCOPE))) { persist = true; getAllocatedHostUuidProp(v).set(candidate.getHostUuid()); } if (VolumeConstants.ACCESS_MODE_SINGLE_HOST_RW.equals(v.getAccessMode())) { persist = true; DataAccessor.setField(v, VolumeConstants.FIELD_LAST_ALLOCATED_HOST_ID, newHost); } if (persist) { objectManager.persist(v); } } }

Target:
void updateVolumeHostInfo(AllocationAttempt attempt, AllocationCandidate candidate, Long newHost) { List<Object> storageDriverIds = new ArrayList<>(); for (Volume v : attempt.getVolumes()) { if (v.getStorageDriverId() != null) { storageDriverIds.add(v.getStorageDriverId()); } } Map<Object, Object> criteria = new HashMap<Object, Object>(); criteria.put(STORAGE_DRIVER.REMOVED, new io.github.ibuildthecloud.gdapi.condition.Condition(ConditionType.NULL)); criteria.put(STORAGE_DRIVER.ID, new io.github.ibuildthecloud.gdapi.condition.Condition(ConditionType.IN, storageDriverIds)); List<StorageDriver> drivers = objectManager.find(StorageDriver.class, criteria); Map<Long, StorageDriver> storageDrivers = new HashMap<>(); for (StorageDriver d : drivers) { storageDrivers.put(d.getId(), d); } for (Volume v : attempt.getVolumes()) { boolean persist = false; StorageDriver d = v.getStorageDriverId() != null ? storageDrivers.get(v.getStorageDriverId()) : null; if (d != null && StorageDriverConstants.SCOPE_LOCAL.equals(DataAccessor.fieldString(d, StorageDriverConstants.FIELD_SCOPE))) { persist = true; getAllocatedHostUuidProp(v).set(candidate.getHostUuid()); } if (VolumeConstants.ACCESS_MODE_SINGLE_HOST_RW.equals(v.getAccessMode())) { persist = true; DataAccessor.fromDataFieldOf(v).withKey(VolumeConstants.FIELD_LAST_ALLOCATED_HOST_ID).set(newHost); } if (persist) { objectManager.persist(v); } } }
Source:
private KieServerInstanceAccount getAccount(String id) { Map<String, KieServerInstanceAccount> users = new HashMap<>(); Properties file = loadKieServerInstanceData(); file.stringPropertyNames().forEach(name -> users.put(name, new KieServerInstanceAccount(name, file.getProperty(name)))); return users.get(id); }

Target:
private KieServerInstanceAccount getAccount(String id) { Properties file = loadKieServerInstanceData(); if (!file.containsKey(id)) { return null; } return new KieServerInstanceAccount(id, file.getProperty(id)); }
Source:
public void doRunWithObjectSafepoints(final ActorProcessingThread t) { WebDebugger dbg = null; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { dbg = vm.getWebDebugger(); assert dbg != null; } t.currentlyExecutingActor = actor; if (VmSettings.UNIFORM_TRACING) { UniformExecutionTrace.recordActivityContext(actor, tracer); } else if (VmSettings.KOMPOS_TRACING) { KomposTrace.currentActivity(actor); } while (getCurrentMessagesOrCompleteExecution()) { processCurrentMessages(t, dbg); } if (VmSettings.UNIFORM_TRACING || VmSettings.KOMPOS_TRACING) { t.swapTracingBufferIfRequestedUnsync(); } t.currentlyExecutingActor = null; }

Target:
private void doRunWithObjectSafepoints(final ActorProcessingThread t) { WebDebugger dbg = null; if (VmSettings.TRUFFLE_DEBUGGER_ENABLED) { dbg = vm.getWebDebugger(); assert dbg != null; } t.currentlyExecutingActor = actor; if (VmSettings.UNIFORM_TRACING) { UniformExecutionTrace.recordActivityContext(actor, tracer); } else if (VmSettings.KOMPOS_TRACING) { KomposTrace.currentActivity(actor); } while (getCurrentMessagesOrCompleteExecution()) { processCurrentMessages(t, dbg); } }
Source:
public void purgeOrderType_shouldPurgeOrderTypeIfNotUse() { OrderService orderService = Context.getOrderService(); orderService.purgeOrderType(orderService.getOrderType(13)); assertNull(orderService.getOrderType(13)); }

Target:
public void purgeOrderType_shouldPurgeOrderTypeIfNotUse() { OrderService orderService = Context.getOrderService(); OrderType orderType = orderService.getOrderType(13); assertNotNull(orderType); orderService.purgeOrderType(orderType); assertNull(orderService.getOrderType(13)); }
Source:
protected FakeApplication provideFakeApplication() { final int port = BASE_PORT + RANDOM.nextInt(1000); final String jdbcUrl = "jdbc:h2:./target/h2/metrics" + RANDOM.nextInt(1000) + ":portal;AUTO_SERVER=TRUE;AUTO_SERVER_PORT=" + port + ";MODE=PostgreSQL;INIT=create schema if not exists portal;DB_CLOSE_DELAY=-1"; return new FakeApplication( new java.io.File("."), Helpers.class.getClassLoader(), ImmutableMap.of("db.metrics_portal_ddl.url", jdbcUrl, "db.default.url", jdbcUrl), new ArrayList<String>(), null); }

Target:
protected FakeApplication provideFakeApplication() { final String jdbcUrl = H2ConnectionStringFactory.generateJdbcUrl(); return new FakeApplication( new java.io.File("."), Helpers.class.getClassLoader(), ImmutableMap.of("db.metrics_portal_ddl.url", jdbcUrl, "db.default.url", jdbcUrl), new ArrayList<String>(), null); }
Source:
public String getName() { return SanitizationHelper.sanitizeForHtml(name); }

Target:
public String getName() { return name; }
Source:
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { if(DefaultDebugExecutor.EXECUTOR_ID.equals(executorId)) { return false; } return DefaultRunExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof GoRunConfigurationBase; }

Target:
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) { return DefaultRunExecutor.EXECUTOR_ID.equals(executorId) && profile instanceof GoRunConfigurationBase; }
Source:
public int openCallback(String path, ByteBuffer buf) { try { return open(path, FuseFileInfo.wrap(buf)); } catch (Exception e) { e.printStackTrace(); return -ErrorCodes.EIO(); } }

Target:
public int openCallback(String path, ByteBuffer buf) { try { return open(path, FuseFileInfo.wrap(buf)); } catch (Exception e) { LOG.error("Failed to open {}: ", path, e); return -ErrorCodes.EIO(); } }
Source:
public boolean add(Entity entity){ if (entity == null){ throw new IllegalArgumentException("Cannot add null entity"); } if (!isPassable() && !entity.isHideable()){ throw new RuntimeException( "Cannot place nonHidable object on impassable Square" ); } if (!entity.isPassable()){ if (!isPassable()){ throw new RuntimeException("Tried to add second impassable entity"); } impassableEntity = entity; return true; } return passableEntities.add(entity); }

Target:
public boolean add(Entity entity){ if (entity == null){ throw new IllegalArgumentException("Cannot add null entity"); } if (!isPassable() && !entity.isHideable()){ throw new IllegalArgumentException( "Cannot place nonHidable object on impassable Square" ); } if (!entity.isPassable()){ if (!isPassable()){ throw new IllegalArgumentException("Tried to add second impassable entity"); } impassableEntity = entity; return true; } return passableEntities.add(entity); }
Source:
protected String imageIdForZone(String zoneId) { ImageApi imageApi = api.getImageApiForZone(zoneId); return Iterables.getFirst(imageApi.list().concat(), null).getId(); }

Target:
protected String imageIdForZone(String zoneId) { ImageApi imageApi = api.getImageApiForZone(zoneId); return Iterables.get(imageApi.list().concat(), 0).getId(); }
Source:
private void updateDiskVmSnapshotId() { if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { Guid snapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); getImageDao().updateImageVmSnapshotId(disk.getId(), snapshotId); ((DiskImage) disk).setvm_snapshot_id(snapshotId); } }

Target:
private void updateDiskVmSnapshotId() { if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { Guid snapshotId = getSnapshotDao().getId(getVmId(), SnapshotType.ACTIVE); DiskImage diskImage = ((DiskImage) disk); getImageDao().updateImageVmSnapshotId(diskImage.getImageId(), snapshotId); diskImage.setvm_snapshot_id(snapshotId); } }
Source:
public boolean hasNext() { if (this.count < this.values.count()) { return true; } return false; }

Target:
public boolean hasNext() { return this.count < this.values.count(); }
Source:
ImplementationInvocationMetadata(Method declaredMethod, Method baseClassMethod) { if (!KotlinDetector.isKotlinReflectPresent()) { suspendedDeclaredMethod = false; suspendedBaseClassMethod = false; reactiveBaseClassMethod = false; return; } KFunction<?> declaredFunction = ReflectionUtils.isKotlinClass(declaredMethod.getDeclaringClass()) ? KotlinReflectionUtils.findKotlinFunction(declaredMethod) : null; KFunction<?> baseClassFunction = ReflectionUtils.isKotlinClass(baseClassMethod.getDeclaringClass()) ? KotlinReflectionUtils.findKotlinFunction(baseClassMethod) : null; suspendedDeclaredMethod = declaredFunction != null && declaredFunction.isSuspend(); suspendedBaseClassMethod = baseClassFunction != null && baseClassFunction.isSuspend(); this.reactiveBaseClassMethod = !suspendedBaseClassMethod && ReactiveWrapperConverters.supports(baseClassMethod.getReturnType()); }

Target:
ImplementationInvocationMetadata(Method declaredMethod, Method baseClassMethod) { if (!KotlinDetector.isKotlinReflectPresent()) { suspendedDeclaredMethod = false; suspendedBaseClassMethod = false; reactiveBaseClassMethod = false; return; } KFunction<?> declaredFunction = KotlinDetector.isKotlinType(declaredMethod.getDeclaringClass()) ? KotlinReflectionUtils.findKotlinFunction(declaredMethod) : null; KFunction<?> baseClassFunction = KotlinDetector.isKotlinType(baseClassMethod.getDeclaringClass()) ? KotlinReflectionUtils.findKotlinFunction(baseClassMethod) : null; suspendedDeclaredMethod = declaredFunction != null && declaredFunction.isSuspend(); suspendedBaseClassMethod = baseClassFunction != null && baseClassFunction.isSuspend(); this.reactiveBaseClassMethod = !suspendedBaseClassMethod && ReactiveWrapperConverters.supports(baseClassMethod.getReturnType()); }
Source:
private void verifyReplicationProceeded() throws Exception { try (Table table = utility1.getConnection().getTable(TABLE)) { Put put = new Put(ROW); put.addColumn(NORMAL_CF, QUALIFIER, VALUE); table.put(put); } try (Table peerTable = utility2.getConnection().getTable(TABLE)) { for (int i = 0; i < NB_RETRIES; i++) { if (i == NB_RETRIES - 1) { fail("Waited too much time for put replication"); } Result result = peerTable.get(new Get(ROW).addColumn(NORMAL_CF, QUALIFIER)); if (result == null || result.isEmpty()) { LOG.info("Row not available in peer cluster"); Thread.sleep(SLEEP_TIME); } else { assertArrayEquals(VALUE, result.getValue(NORMAL_CF, QUALIFIER)); break; } } } }

Target:
private void verifyReplicationProceeded() throws Exception { try (Table table = utility1.getConnection().getTable(TABLE)) { Put put = new Put(ROW); put.addColumn(NORMAL_CF, QUALIFIER, VALUE); table.put(put); } utility2.waitFor(NB_RETRIES * SLEEP_TIME, (Predicate<Exception>) () -> { try (Table peerTable = utility2.getConnection().getTable(TABLE)) { Result result = peerTable.get(new Get(ROW).addColumn(NORMAL_CF, QUALIFIER)); return result != null && !result.isEmpty() && Bytes.equals(VALUE, result.getValue(NORMAL_CF, QUALIFIER)); } }); }
Source:
private void setupLanguagePreference(final ListPreference languagePref) { Locale[] locales = getLocales(BuildConfig.SUPPORTED_LOCALES); Arrays.sort(locales, new Comparator<Locale>() { @Override public int compare(Locale o1, Locale o2) { return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName()); } }); String[] displayNames = new String[locales.length]; String[] entryValues = new String[locales.length]; for(int index = 0; index < locales.length; index++) { Locale locale = locales[index]; displayNames[index] = locale.getDisplayName(locale); entryValues[index] = getLanguageCountryCode(locale); } languagePref.setValue(getLanguageCountryCode(getCurrentLocale())); languagePref.setEntries(displayNames); languagePref.setEntryValues(entryValues); languagePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object o) { languagePref.setValue(o.toString()); updatePreferredLanguage(o.toString()); return true; } }); }

Target:
private void setupLanguagePreference(final ListPreference languagePref) { Locale[] locales = getLocales(); final Locale currentLocale = getCurrentLocale(); Arrays.sort(locales, new Comparator<Locale>() { @Override public int compare(Locale o1, Locale o2) { return o1.getDisplayName().compareToIgnoreCase(o2.getDisplayName()); } }); String[] displayNames = new String[locales.length]; String[] entryValues = new String[locales.length]; for(int index = 0; index < locales.length; index++) { Locale locale = locales[index]; displayNames[index] = locale.getDisplayName(locale); entryValues[index] = getLanguageCountryCode(locale); } languagePref.setValue(getLanguageCountryCode(currentLocale)); languagePref.setEntries(displayNames); languagePref.setEntryValues(entryValues); languagePref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @Override public boolean onPreferenceChange(Preference preference, Object o) { languagePref.setValue(o.toString()); updatePreferredLanguage(o.toString()); return true; } }); }
Source:
public void testDetached() { final CountDownLatch stopped = new CountDownLatch(1); ZThread.start((args) -> { ZContext ctx = new ZContext(); Socket push = ctx.createSocket(SocketType.PUSH); assertThat(push, notNullValue()); ctx.close(); stopped.countDown(); }); try { stopped.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } }

Target:
public void testDetached() { final CountDownLatch stopped = new CountDownLatch(1); ZThread.start((args) -> { try (ZContext ctx = new ZContext()) { Socket push = ctx.createSocket(SocketType.PUSH); assertThat(push, notNullValue()); } stopped.countDown(); }); try { stopped.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace(); } }
Source:
public void run(IProgressMonitor monitor) throws CoreException { if (!repository.getRepositoryState().canCheckout()) { MessageDialog.openError(getShell(), UIText.BranchAction_cannotCheckout, NLS.bind( UIText.BranchAction_repositoryState, repository .getRepositoryState().getDescription())); return; } if (refName == null) { BranchSelectionDialog dialog = new BranchSelectionDialog( getShell(), repository); if (dialog.open() != Window.OK) { return; } refName = dialog.getRefName(); } bop = new BranchOperation(repository, refName); bop.execute(monitor); BranchResultDialog.show(bop.getResult(), repository, refName); }

Target:
public void run(IProgressMonitor monitor) throws CoreException { if (!repository.getRepositoryState().canCheckout()) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { MessageDialog.openError(getShell(), UIText.BranchAction_cannotCheckout, NLS.bind( UIText.BranchAction_repositoryState, repository.getRepositoryState() .getDescription())); } }); return; } if (refName == null) { BranchSelectionDialog dialog = new BranchSelectionDialog( getShell(), repository); if (dialog.open() != Window.OK) { return; } refName = dialog.getRefName(); } bop = new BranchOperation(repository, refName); bop.execute(monitor); BranchResultDialog.show(bop.getResult(), repository, refName); }
Source:
public long writeTo(WritableByteChannel channel) throws IOException { long written = 0; if (!isSendComplete()) { written = channel.write(buffer); } return written; }

Target:
public long writeTo(WritableByteChannel channel) throws IOException { return isSendComplete() ? 0 : channel.write(buffer); }
Source:
public IBinding getBinding() { if (fBinding == null && fParameterOwner != null) { ICPPParameter[] parameters = fParameterOwner.getParameters(); fBinding = parameters[fParameterPosition]; } return fBinding; }

Target:
public IBinding getBinding() { if (fBinding == null) { ICPPParameter[] parameters = fParameterOwner.getParameters(); fBinding = parameters[fParameterPosition]; } return fBinding; }
Source:
public String toString() { return "MistWatermarkEvent with timestamp: " + timestamp; }

Target:
public String toString() { return new StringBuilder("MistWatermarkEvent with timestamp: ") .append(timestamp) .toString(); }
Source:
private void logUnhandledException(Throwable ex) { String errMessage = String.format("Got exception: [%s] / message [%s]", ex.getClass().getSimpleName(), ex.getMessage()); StackTraceElement elem = findFirstResourceCallFromCallStack(ex.getStackTrace()); String resourceClassName = null; if (elem != null) { errMessage += String.format(" / related resource location: [%s.%s](%s:%d)", elem.getClassName(), elem.getMethodName(), elem.getFileName(), elem.getLineNumber()); resourceClassName = elem.getClassName(); } Logger log = getEffectiveLogger(resourceClassName); recordExceptionLog(log, errMessage, ex); }

Target:
private void logUnhandledException(Throwable ex) { String errMessage = String.format("Got exception: [%s] / message [%s]", ex.getClass().getSimpleName(), ex.getMessage()); StackTraceElement elem = findFirstResourceCallFromCallStack(ex.getStackTrace()); String resourceClassName = null; if (elem != null) { errMessage += String.format(" / related resource location: [%s.%s](%s:%d)", elem.getClassName(), elem.getMethodName(), elem.getFileName(), elem.getLineNumber()); resourceClassName = elem.getClassName(); } Logger log = getEffectiveLogger(resourceClassName); log.error(errMessage, ex); }