auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected StringBuilder customizeAfterNewLineForDeclaration(IDocument doc, IASTDeclaration dec, ITypedRegion region) { return customizeAfterNewLineForDeclaration(doc, dec, region, null); }

Target:
protected StringBuilder customizeAfterNewLineForDeclaration(IDocument doc, IASTDeclaration dec, ITypedRegion region) { return new StringBuilder(); }
Source:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (property==null) return false; switch (property) { case "simple": //$NON-NLS-1$ return "simple".equals(expectedValue); //$NON-NLS-1$ case "overridden": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ case "ordering": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ case "chainOrdering": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ default: break; } Assert.isTrue(false); return false; }

Target:
public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (property == null) { return false; } switch (property) { case "simple": //$NON-NLS-1$ return "simple".equals(expectedValue); //$NON-NLS-1$ case "overridden": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ case "ordering": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ case "chainOrdering": //$NON-NLS-1$ return "A".equals(expectedValue); //$NON-NLS-1$ default: break; } Assert.isTrue(false); return false; }
Source:
public CreateInternalVariableCommand(final BasicFBType fbType) { this.dataType = DataTypeLibrary.getInstance().getType("BOOL"); //$NON-NLS-1$ this.fbType = fbType; this.name = DEFAULT_VAR_NAME; this.index = fbType.getInternalVars().size() - 1; }

Target:
public CreateInternalVariableCommand(final BasicFBType fbType) { this(fbType, fbType.getInternalVars().size() - 1, null, null); }
Source:
protected void consumeRecordHeaderNameWithTypeParameters() { // RecordHeaderName ::= RecordHeaderName1 TypeParameters consumeTypeHeaderNameWithTypeParameters(); TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr]; typeDecl.modifiers |= ExtraCompilerModifiers.AccRecord; }

Target:
protected void consumeRecordHeaderNameWithTypeParameters() { // RecordHeaderName ::= RecordHeaderName1 TypeParameters consumeTypeHeaderNameWithTypeParameters(); }
Source:
public static ProxyData[] getProxyData(String provider) { ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); switch (provider) { case DIRECT_PROVIDER: return new ProxyData[0]; case ECLIPSE_PROVIDER: return castArray(manager.getProxyData()); case NATIVE_PROVIDER: return castArray(manager.getNativeProxyData()); default: break; } throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ }

Target:
public static ProxyData[] getProxyData(String provider) { ProxyManager manager = (ProxyManager) ProxyManager.getProxyManager(); switch (provider) { case DIRECT_PROVIDER: return new ProxyData[0]; case ECLIPSE_PROVIDER: return castArray(manager.getProxyData()); case NATIVE_PROVIDER: return castArray(manager.getNativeProxyData()); default: throw new IllegalArgumentException("Provider not supported"); //$NON-NLS-1$ } }
Source:
private void createTextMenu() { final MenuManager popupManager = new MenuManager(); // FIXME missing commands for EDIT_COPY and EDIT_SELECT_ALL // as context menu textWidget.setMenu(popupManager.createContextMenu(textWidget)); textWidget.addDisposeListener(e -> { popupManager.dispose(); }); }

Target:
private void createTextMenu() { final MenuManager popupManager = new MenuManager(); // FIXME missing commands for EDIT_COPY and EDIT_SELECT_ALL // as context menu textWidget.setMenu(popupManager.createContextMenu(textWidget)); textWidget.addDisposeListener(e -> popupManager.dispose()); }
Source:
switch (platform) { case "win32": //$NON-NLS-1$ COLUMN_TRIM= 4; break; case "carbon": //$NON-NLS-1$ COLUMN_TRIM= 24; break; case "cocoa": //$NON-NLS-1$ default: COLUMN_TRIM= 3; break; }

Target:
switch (platform) { case "win32": //$NON-NLS-1$ COLUMN_TRIM= 4; break; case "cocoa": //$NON-NLS-1$ COLUMN_TRIM= 24; break; default: COLUMN_TRIM= 3; break; }
Source:
int getLineHeight(int lineIndex) { LineSizeInfo line = getLineSize(lineIndex); if (line.needsRecalculateHeight()) { // here we are in "variable line height", the call of calculate which uses TextLayout is very slow // so use the average line height of all calculated lines. This should be good enough for scrolling. if (isVariableHeight(lineIndex)) { return Math.round(averageLineHeight); } else { line.height = getLineHeight() + getLineSpacing(lineIndex); } } return line.height; }

Target:
int getLineHeight(int lineIndex) { return getLineHeight(lineIndex, true); }
Source:
protected void activateDefaultView(String deepLinkPath) { boolean isStartup = m_attachedCount <= 1; if (safeHandleDeepLink(deepLinkPath)) { // NOP } else if (isStartup) { interceptDefaultView(); } }

Target:
protected void activateDefaultView(String deepLinkPath) { if (safeHandleDeepLink(deepLinkPath)) { return; } if (m_attachedCount <= 1) { // is startup? interceptDefaultView(); } }
Source:
private FilterCache() { // Load in the background. Use a daemon thread since this instantiation // may occur very early; the JobManager may perhaps even be still // suspended. loader = new Thread(this::loadFromPreferences); loader.setDaemon(true); loader.start(); }

Target:
private FilterCache() { // Singleton }
Source:
public boolean visit(MethodDeclaration node) { Block body= node.getBody(); if (body == null) return false; Selection selection= getSelection(); int nodeStart= body.getStartPosition(); int nodeExclusiveEnd= nodeStart + body.getLength(); // if selection node inside of the method body ignore method if (((nodeStart >= selection.getOffset()) || (selection.getExclusiveEnd() >= nodeExclusiveEnd))) return false; return super.visit(node); }

Target:
public boolean visit(MethodDeclaration node) { Block body= node.getBody(); if (body == null) return false; Selection selection= getSelection(); int nodeStart= body.getStartPosition(); int nodeExclusiveEnd= nodeStart + body.getLength(); // if selection node inside of the method body ignore method if ((nodeStart >= selection.getOffset()) || (selection.getExclusiveEnd() >= nodeExclusiveEnd)) return false; return super.visit(node); }
Source:
private static AdvancedInformation executeAut(AutLaunch launch) { AdvancedInformation info = null; try { // try to obtain advanced error information from AUT final GetAdvancedInfo advInfoCmd = TeslaFactory.eINSTANCE .createGetAdvancedInfo(); final Object obj = launch.execute(advInfoCmd); if (obj instanceof AdvancedInformation) info = (AdvancedInformation) obj; } catch (Exception e) { return (AdvancedInformation) RcpttPlugin.createStatus(e); } return info; }

Target:
private static AdvancedInformation executeAut(AutLaunch launch) { AdvancedInformation info = null; try { // try to obtain advanced error information from AUT final GetAdvancedInfo advInfoCmd = TeslaFactory.eINSTANCE .createGetAdvancedInfo(); final Object obj = launch.execute(advInfoCmd); if (obj instanceof AdvancedInformation) info = (AdvancedInformation) obj; } catch (Exception e) { RcpttPlugin.log(e); } return info; }
Source:
public void testObtainCertificateChain() throws Exception { server = setupTestObtainCertificate(false); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; // randomly generated domain name obtainCertificateChain(null, -1, account, domainName); }

Target:
public void testObtainCertificateChain() throws Exception { server = setupTestObtainCertificate(); AcmeAccount account = populateAccount(ACCOUNT_3_V2); String domainName = "fjsljghasldfjgkv2.com"; // randomly generated domain name obtainCertificateChain(null, -1, account, domainName); }
Source:
public MappedRoleMapper() { this.reverseRoleMap = new LinkedHashMap<>(); this.removeMapped = true; //not keeping any delegate roles as there is no way to avoid configuration conflicts this.removeNonMapped = true; //this functionality is possible to recreate by manually combining role mappers this.keyRoles = Roles.NONE; }

Target:
public MappedRoleMapper()
Source:
public TimberClientHandler(TimberClient client, ClientBootstrap bootstrap) { // Do we need to call super()? Since we extend SimpleChannelUpstreamHandler // it is likely the answer is yes. super(); this.client = client; this.bootstrap = bootstrap; timer = new HashedWheelTimer(); }

Target:
public TimberClientHandler(TimberClient client, ClientBootstrap bootstrap) { this.client = client; this.bootstrap = bootstrap; timer = new HashedWheelTimer(); }
Source:
private Properties loadStringProperties(String body) { Properties properties = new Properties(); try { properties.load(new StringReader(body)); } catch (IOException e) { e.printStackTrace(); } return properties; }

Target:
private Properties loadStringProperties(String body) { Properties properties = new Properties(); try { properties.load(new StringReader(body)); } catch (IOException e) { // IOException will never occur here because we're loading directly from a String } return properties; }
Source:
protected boolean canReplaceBiome(int biomeId) { Biome biome = Biome.getBiomeForId(biomeId); if (biome == null) { if (BCLib.DEV) //don't spam outside of dev, it's way to noisy BCLog.logger.warn("Couldn't find a biome with an ID of " + biomeId); return false; } return BiomeDictionary.getTypes(biome).containsAll(REQUIRED_TYPES); }

Target:
protected boolean canReplaceBiome(int biomeId) { Biome biome = Biome.getBiomeForId(biomeId); if (biome == null) { return false; } return BiomeDictionary.getTypes(biome).containsAll(REQUIRED_TYPES); }
Source:
public void setMainLoopActionBarTitle(int mainLoopStopNum, int mainLoopStopsSize) { setTitle(getResources().getString(R.string.stop_nav_main_loop) + " " + mainLoopStopNum + " of " + mainLoopStopsSize); }

Target:
public void setMainLoopActionBarTitle(int mainLoopStopNum, int mainLoopStopsSize) { setTitle(String.format(getResources().getString(R.string.stop_nav_main_loop, mainLoopStopNum, mainLoopStopsSize))); }
Source:
public void eachNonZeroInColumn(int j, MatrixProcedure procedure) { int k = columnPointers[j], i = k; while (i < columnPointers[j + 1]) { procedure.apply(rowIndices[i], j, values[i]); i++; } }

Target:
public void eachNonZeroInColumn(int j, MatrixProcedure procedure) { for (int i = columnPointers[j]; i < columnPointers[j + 1]; i++) { procedure.apply(rowIndices[i], j, values[i]); } }
Source:
public String unQuote(final String quoted) { if (quoted == null || quoted.length() <= 2) { return quoted; } String result = quoted.startsWith("\"") ? quoted.substring(1) : quoted; return result.endsWith("\"") ? result.substring(0, result.length() - 1) : result; }

Target:
String unQuote(final String quoted) { if (quoted == null || quoted.length() <= 2) { return quoted; } String result = quoted.startsWith("\"") ? quoted.substring(1) : quoted; return result.endsWith("\"") ? result.substring(0, result.length() - 1) : result; }
Source:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { super.checkFile(file, problemsHolder); if (!GoTestFinder.isTestFile(file)) return; for (GoImportSpec importSpec : file.getImports()) { if (importSpec.isCImport()) { problemsHolder.registerProblem(importSpec, "Usage of cgo in tests is not supported.", new GoDeleteImportQuickFix()); } } }

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (!GoTestFinder.isTestFile(file)) return; for (GoImportSpec importSpec : file.getImports()) { if (importSpec.isCImport()) { problemsHolder.registerProblem(importSpec, "Usage of cgo in tests is not supported.", new GoDeleteImportQuickFix()); } } }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitDeferStatement(@NotNull GoDeferStatement o) { PsiElement parent = PsiTreeUtil .getParentOfType(o, GoForStatement.class, GoFunctionLit.class, GoFunctionDeclaration.class, GoMethodDeclaration.class, GoFile.class); if (parent instanceof GoForStatement) { holder.registerProblem(o, "Possible resource leak, \"defer\" is called in a for loop.", ProblemHighlightType.WEAK_WARNING); } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitDeferStatement(@NotNull GoDeferStatement o) { PsiElement parent = PsiTreeUtil .getParentOfType(o, GoForStatement.class, GoFunctionLit.class); if (parent instanceof GoForStatement) { holder.registerProblem(o, "Possible resource leak, \"defer\" is called in a for loop.", ProblemHighlightType.WEAK_WARNING); } } }; }
Source:
public FormattingModel createModel(@NotNull PsiElement element, @NotNull CodeStyleSettings settings) { // TODO decide if this is a good thing to do or not. // Given the go docs and the community enforce the rules for tabs // The plugin should try and emulate the gofmt behavior, which replaces spaces with tabs for idents // For more detail see: http://golang.org/doc/effective_go.html#formatting if (settings.getIndentOptions() != null) { settings.getIndentOptions().USE_TAB_CHARACTER = true; settings.getIndentOptions().SMART_TABS = false; } Block block = new GoFormattingBlock(element.getNode(), null, Indent.getNoneIndent(), null, settings, createSpacingBuilder(settings)); return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings); }

Target:
public FormattingModel createModel(@NotNull PsiElement element, @NotNull CodeStyleSettings settings) { Block block = new GoFormattingBlock(element.getNode(), null, Indent.getNoneIndent(), null, settings, createSpacingBuilder(settings)); return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), block, settings); }
Source:
public boolean isType(TileEntity tile, EnumFacing dir) { if (tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir)) { IGridNode tempNode = ((IGridHost) tile).getGridNode(AEPartLocation.fromFacing(dir)); //for some reason when AE loads (5 ticks) this is null if (tempNode == null) //should not be a problem because interfaces are still treated like IInvertoryHandler return false; return true; } return false; }

Target:
public boolean isType(TileEntity tile, EnumFacing dir) { if (tile instanceof IGridHost && tile.hasCapability(LPStorageMonitorableAccessor.STORAGE_MONITORABLE_ACCESSOR_CAPABILITY, dir)) { return ((IGridHost) tile).getGridNode(AEPartLocation.fromFacing(dir)) != null; } return false; }
Source:
protected void buildSrcAttribute(final ComponentTag tag, IModel<?> srcModel) { if (srcModel != null) { tag.put("src", srcModel.getObject().toString()); } }

Target:
protected void buildSrcAttribute(final ComponentTag tag, IModel<?> srcModel) { tag.put("src", String.valueOf(srcModel.getObject())); }
Source:
public void addHeader(String name, String value) { if (name != null && name.equalsIgnoreCase("COOKIE")) { this.cookieInHeaders = value; } else if (name != null && !HEADERS_TO_IGNORE.contains(name)) { headers.put(name, value); } }

Target:
public void addHeader(String name, String value) { if ("COOKIE".equalsIgnoreCase(name)) { this.cookieInHeaders = value; } else if (!HEADERS_TO_IGNORE.contains(name)) { headers.put(name, value); } }
Source:
public void setupStaticKeyspace() throws Exception { migrate(); // Need this legacy stuff for queues if ( USE_VIRTUAL_KEYSPACES ) { logger.info( "Creating static application keyspace " + getApplicationKeyspace() ); cass.createColumnFamily( getApplicationKeyspace(), createColumnFamilyDefinition( getApplicationKeyspace(), APPLICATIONS_CF, ComparatorType.BYTESTYPE ) ); cass.createColumnFamilies( getApplicationKeyspace(), getCfDefs( ApplicationCF.class, getApplicationKeyspace() ) ); cass.createColumnFamilies( getApplicationKeyspace(), getCfDefs( QueuesCF.class, getApplicationKeyspace() ) ); } }

Target:
public void setupStaticKeyspace() throws Exception { migrate(); // Need this legacy stuff for queues logger.info( "Creating static application keyspace " + getApplicationKeyspace() ); cass.createColumnFamily( getApplicationKeyspace(), createColumnFamilyDefinition( getApplicationKeyspace(), APPLICATIONS_CF, ComparatorType.BYTESTYPE ) ); cass.createColumnFamilies( getApplicationKeyspace(), getCfDefs( ApplicationCF.class, getApplicationKeyspace() ) ); cass.createColumnFamilies( getApplicationKeyspace(), getCfDefs( QueuesCF.class, getApplicationKeyspace() ) ); }
Source:
public String getString( final Object key ) { //All values are strings , so doing the cast here saves doing the cast elsewhere return String.valueOf(getDynamicProperties().get( key )); }

Target:
public String getString( final Object key ) { //All values are strings , so doing the cast here saves doing the cast elsewhere return (String) getDynamicProperties().get( key ); }
Source:
public void addKerberosAuthentication(UserEntity userEntity, String principalName, boolean persist) throws AmbariException { addAuthentication(userEntity, UserAuthenticationType.KERBEROS, principalName, new Validator() { @Override public void validate(UserEntity userEntity, String key) throws AmbariException { // Ensure no other authentication entries exist for the same principal... if (!CollectionUtils.isEmpty(userAuthenticationDAO.findByTypeAndKey(UserAuthenticationType.KERBEROS, key))) { throw new AmbariException("The authentication type already exists for this principal"); } } }, persist); }

Target:
public void addKerberosAuthentication(UserEntity userEntity, String principalName, boolean persist) throws AmbariException { addAuthentication(userEntity, UserAuthenticationType.KERBEROS, principalName, (user, key) -> { // Ensure no other authentication entries exist for the same principal... if (!CollectionUtils.isEmpty(userAuthenticationDAO.findByTypeAndKey(UserAuthenticationType.KERBEROS, key))) { throw new AmbariException("The authentication type already exists for this principal"); } }, persist); }
Source:
public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = mapper.orElseGet(() -> new ObjectMapper()).convertValue(this, new TypeReference<Map<String, String>>(){}); if ( !Boolean.parseBoolean(map.get("keyStore")) ) { // keyStore is declared as a primitive value instead of Boolean -> treat false as unset map.remove("keyStore"); } return map; }

Target:
public Map<String, String> toMap(Optional<ObjectMapper> mapper) { Map<String, String> map = mapper.orElseGet(ObjectMapper::new).convertValue(this, new TypeReference<Map<String, String>>(){}); if ( !Boolean.parseBoolean(map.get("keyStore")) ) { // keyStore is declared as a primitive value instead of Boolean -> treat false as unset map.remove("keyStore"); } return map; }
Source:
public boolean include(String value, String defaultValue) { return value != null && ( defaultValue == null || !Objects.equals(StringUtils.trim(defaultValue), StringUtils.trim(value)) ); }

Target:
public boolean include(String value, String defaultValue) { return true; }
Source:
public ContentHighlighter getHighlighter() { ContentHighlighter t = null; try { t = (ContentHighlighter) Class.forName(getBolderClass()) .getConstructor(new Class[] { GenericConfiguration.class }).newInstance(config); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return t; }

Target:
public ContentHighlighter getHighlighter() { ContentHighlighter t = null; try { t = (ContentHighlighter) Class.forName(getBolderClass()) .getConstructor(new Class[] { GenericConfiguration.class }).newInstance(config); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { LOGGER.error(e); } return t; }
Source:
protected void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); // Command block logic overrode this and the custom name is // somewhat set to the command block's name ("@") compound.setString("CustomName", getCustomNameTag()); }

Target:
protected void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); // Command block logic overrode this and the custom name is // somewhat set to the command block's name ("@") if (!getCustomNameTag().isEmpty()) { compound.setString("CustomName", getCustomNameTag()); } }
Source:
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(super.toString()); // for field buffer.append(":"); buffer.append(value == null ? "" : value); buffer.append("^"); buffer.append(boost); return buffer.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); builder.append(super.toString()); // for field builder.append(value == null ? "" : value); builder.append("^").append(boost); return builder.toString(); }
Source:
public String toString() { StringBuffer buffer = new StringBuffer(); if (queries != null) { for (Term q : queries) { buffer.append(q).append(","); } } buffer.append("^").append(boost).append("tieBraker:").append(tieBraker); return buffer.toString(); }

Target:
public String toString() { StringBuilder builder = new StringBuilder(); if (queries != null) { for (Term q : queries) { builder.append(q).append(","); } } builder.append("^").append(boost).append("tieBraker:").append(tieBraker); return builder.toString(); }
Source:
public void tagPicture(View view) { MapleApplication app = (MapleApplication) getApplication(); // save company tag companyTag = companySuggest.getText().toString(); app.setCurrentCompany(companyTag); // update header ((TextView) this.findViewById(R.id.header)) .setText("Customize Your Ad"); // set company Button ((Button) findViewById(R.id.changeTag)).setText(companyTag); toggleOptions(); }

Target:
public void tagPicture(View view) { // save company tag companyTag = companySuggest.getText().toString(); app.setCurrentCompany(companyTag); // update header ((TextView) this.findViewById(R.id.header)) .setText("Customize Your Ad"); // set company Button ((Button) findViewById(R.id.changeTag)).setText(companyTag); toggleOptions(); }
Source:
public ProcessExtensionModel getExtensionsForId(String processDefinitionId) { ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId); System.out.println("processDefinition = " + processDefinition); ProcessExtensionModel processExtensionModel = getExtensionsFor(processDefinition); return processExtensionModel != null ? processExtensionModel : EMPTY_EXTENSIONS; }

Target:
public ProcessExtensionModel getExtensionsForId(String processDefinitionId) { ProcessDefinition processDefinition = repositoryService.getProcessDefinition(processDefinitionId); ProcessExtensionModel processExtensionModel = getExtensionsFor(processDefinition); return processExtensionModel != null ? processExtensionModel : EMPTY_EXTENSIONS; }
Source:
public void processRequest(RequestEvent requestReceivedEvent) { Request request = requestReceivedEvent.getRequest(); ServerTransaction serverTransactionId = requestReceivedEvent .getServerTransaction(); LOG.info("\n\nRequest " + request.getMethod() + " received at " + ProtocolObjects.sipStack.getStackName() + " with server transaction id " + serverTransactionId); // We are the UAC so the only request we get is the BYE. SipProvider provider = (SipProvider) requestReceivedEvent.getSource(); if (request.getMethod().equals(Request.BYE)) processBye(provider, request, serverTransactionId); }

Target:
public void processRequest(RequestEvent requestReceivedEvent) { Request request = requestReceivedEvent.getRequest(); ServerTransaction serverTransactionId = requestReceivedEvent .getServerTransaction(); logger.info("\n\nRequest " + request.getMethod() + " received at " + ProtocolObjects.sipStack.getStackName() + " with server transaction id " + serverTransactionId); // We are the UAC so the only request we get is the BYE. SipProvider provider = (SipProvider) requestReceivedEvent.getSource(); if (request.getMethod().equals(Request.BYE)) processBye(provider, request, serverTransactionId); }
Source:
private SIPDialog findSIPDialogFromInjectionListeners(String dialogId) { SIPDialog dialog = null; synchronized (dialogInjectionListeners) { for(SIPDialogInjectionListener listener : dialogInjectionListeners) { SIPDialog tempDialog = listener.getExternalSIPDialog(dialogId); if(tempDialog != null && tempDialog.getDialogId().equals(dialogId)) { dialog = tempDialog; // Take first valid Dialog and ignore following listener break; } } } return dialog; }

Target:
private SIPDialog findSIPDialogFromInjectionListeners(String dialogId) { SIPDialog dialog = null; for(SIPDialogInjectionListener listener : dialogInjectionListeners) { SIPDialog tempDialog = listener.getExternalSIPDialog(dialogId); if(tempDialog != null && tempDialog.getDialogId().equals(dialogId)) { dialog = tempDialog; // Take first valid Dialog and ignore following listener break; } } return dialog; }
Source:
public String getText() { String arrayText = ""; if(linesOfText != null) arrayText = String.join("\n", linesOfText); if(text.get() != "") return text.get() + "\n" + arrayText; return text.get() + arrayText; }

Target:
public String getText() { String arrayText = ""; if(linesOfText.length > 0) { arrayText = String.join("\n", linesOfText); } if(text.get() != "") { return text.get() + "\n" + arrayText; } return text.get() + arrayText; }
Source:
private boolean isNameValid(String name) { Path destinationPath = PathManager.getInstance().getRecordingPath(name); // invalid characters are filtered, so if the file name is made up of entirely invalid characters, the path will have a blank name. if (destinationPath == PathManager.getInstance().getRecordingPath("")) { return false; } return !StringUtils.isBlank(name); }

Target:
private boolean isNameValid(String name) { Path destinationPath = PathManager.getInstance().getRecordingPath(name); // invalid characters are filtered from paths, so if the file name is made up of entirely invalid characters, the path will have a blank file name. // also acts as a check for blank input. return !destinationPath.equals(PathManager.getInstance().getRecordingPath("")); }
Source:
public Node removeNode(SimpleUri nodeUri) { Preconditions.checkNotNull(nodeUri, "nodeUri cannot be null!"); Node node = findNode(nodeUri); if (!graph.nodes().contains(node)) { throw new RuntimeException("Node removal failure: there is no '" + nodeUri + "' in the render graph!"); } if (graph.adjacentNodes(node).size() != 0) { throw new RuntimeException("Node removal failure: node '" + nodeUri + "' is still connected to other nodes in the render graph!"); } nodeMap.remove(nodeUri); return nodeMap.remove(nodeUri); }

Target:
public Node removeNode(SimpleUri nodeUri) { Preconditions.checkNotNull(nodeUri, "nodeUri cannot be null!"); Node node = findNode(nodeUri); if (node == null) { throw new RuntimeException("Node removal failure: there is no '" + nodeUri + "' in the render graph!"); } if (graph.adjacentNodes(node).size() != 0) { throw new RuntimeException("Node removal failure: node '" + nodeUri + "' is still connected to other nodes in the render graph!"); } nodeMap.remove(nodeUri); return nodeMap.remove(nodeUri); }
Source:
public SetInputTextureFromFbo(int textureSlot, SimpleUri fboUri, FboTexturesTypes textureType, BaseFBOsManager fboManager, ResourceUrn materialUrn, String shaderParameterName) { this.textureSlot = textureSlot; this.textureType = textureType; this.fbo = fboManager.get(fboUri); this.materialUrn = materialUrn; this.shaderParameterName = shaderParameterName; this.material = getMaterial(materialUrn); propertyChange(null); // Cheeky way to initialise textureId fboManager.subscribe(this); }

Target:
public SetInputTextureFromFbo(int textureSlot, SimpleUri fboUri, FboTexturesTypes textureType, BaseFBOsManager fboManager, ResourceUrn materialUrn, String shaderParameterName) { this(textureSlot, fboManager.get(fboUri), textureType, fboManager, materialUrn, shaderParameterName); }
Source:
public void update() { if (screenGrabber.isTakingScreenshot()) { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } else if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } }

Target:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } else { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } }
Source:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } } else { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } }

Target:
public void update() { if (!screenGrabber.isTakingScreenshot()) { if (wasTakingScreenshotLastFrame) { updateFullScale(); regenerateFbos(); wasTakingScreenshotLastFrame = false; } } else { ScreenshotSize screenshotSize = renderingConfig.getScreenshotSize(); // TODO: Remove dependency on Display fullScale.setDimensions(screenshotSize.getWidth(Display.getWidth()), screenshotSize.getHeight(Display.getHeight())); regenerateFbos(); wasTakingScreenshotLastFrame = true; } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); // The way things are set-up right now, we can have FBOs that are not the same size as the display (if scale != 100%). // However, when drawing the final image to the screen, we always want the viewport to match the size of display, // and not that of some FBO. Hence, we are manually setting the viewport via glViewport over here. copyDepthMaterial.setFloat("zNear",activeCamera.getzNear(),true); copyDepthMaterial.setFloat("zFar",activeCamera.getzFar(),true); glViewport(0, 0, Display.getWidth(), Display.getHeight()); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/copyDepth"); renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
private void destroy(EntityRef ref) { // Don't allow the destruction of unloaded entities. long entityId = ref.getId(); entityStore.remove(entityId); entityManager.remove(entityId); if (ref instanceof PojoEntityRef) { ((PojoEntityRef) ref).invalidate(); } componentStore.remove(entityId); }

Target:
private void destroy(EntityRef ref) { // Don't allow the destruction of unloaded entities. long entityId = ref.getId(); entityStore.remove(entityId); entityManager.remove(entityId); ref.invalidate(); componentStore.remove(entityId); }
Source:
public CopyImageToScreenNode(Context context) { WorldRenderer worldRenderer = context.get(WorldRenderer.class); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public CopyImageToScreenNode(Context context) { displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }

Target:
public CopyImageToScreenNode(Context context) { super(context); WorldRenderer worldRenderer = context.get(WorldRenderer.class); requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); displayResolutionDependentFBOs = context.get(DisplayResolutionDependentFBOs.class); addDesiredStateChange(new BindFBO(DEFAULT_FBO, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(DEFAULT_TEXTURED_MATERIAL)); }
Source:
public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); displayResolutionDependentFBOs.subscribe(this); }

Target:
public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise sceneFinalFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); initMainDirectionalLight(); displayResolutionDependentFBOs.subscribe(this); }

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new EnableMaterial(LIGHT_GEOMETRY_MATERIAL.toString())); lightGeometryMaterial = getMaterial(LIGHT_GEOMETRY_MATERIAL); addDesiredStateChange(new DisableDepthTest()); addDesiredStateChange(new EnableBlending()); addDesiredStateChange(new SetBlendFunction(GL_ONE, GL_ONE_MINUS_SRC_COLOR)); addDesiredStateChange(new BindFBO(READONLY_GBUFFER, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise readOnlyGBufferFbo displayResolutionDependentFBOs.subscribe(this); initMainDirectionalLight(); }
Source:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); refractiveReflectiveFbo = requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE, displayResolutionDependentFBOs)); readOnlyGBufferFbo = displayResolutionDependentFBOs.get(READONLY_GBUFFER); addDesiredStateChange(new EnableMaterial(CHUNK_SHADER.toString())); chunkShader = getMaterial(CHUNK_SHADER); displayResolutionDependentFBOs.subscribe(this); }

Target:
public void initialise() { playerCamera = worldRenderer.getActiveCamera(); addDesiredStateChange(new LookThrough(playerCamera)); requiresFBO(new FBOConfig(REFRACTIVE_REFLECTIVE, FULL_SCALE, FBO.Type.HDR).useNormalBuffer(), displayResolutionDependentFBOs); addDesiredStateChange(new BindFBO(REFRACTIVE_REFLECTIVE, displayResolutionDependentFBOs)); update(); // Cheeky way to initialise readOnlyGBufferFbo, refractiveReflectiveFbo displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial(CHUNK_SHADER.toString())); chunkShader = getMaterial(CHUNK_SHADER); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); FBO sceneOpaqueFbo = displayResolutionDependentFBOs.get(new ResourceUrn("engine:sceneOpaque")); sceneOpaqueFbo.bind(); // TODO: remove when we can bind this via a StateChange sceneOpaqueFbo.setRenderBufferMask(true, false, false); glCallList(skySphere); // Draws the skysphere sceneOpaqueFbo.setRenderBufferMask(true, true, true); // TODO: handle these via new StateChange to be created PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/backdrop"); sceneOpaqueFbo.bind(); // TODO: remove when we can bind this via a StateChange sceneOpaqueFbo.setRenderBufferMask(true, false, false); glCallList(skySphere); // Draws the skysphere sceneOpaqueFbo.setRenderBufferMask(true, true, true); // TODO: handle these via new StateChange to be created PerformanceMonitor.endActivity(); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); // TODO: remove and replace with a state change sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: this is necessary - but why? Verify in the shader. renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); // Doesn't exactly help with a lean process() function.. sceneOpaqueFbo.attachDepthBufferTo(refractiveReflectiveFbo); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/applyDeferredLighting"); sceneOpaquePingPongFbo.bind(); // TODO: remove and replace with a state change sceneOpaquePingPongFbo.setRenderBufferMask(true, true, true); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: this is necessary - but why? Verify in the shader. renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); PerformanceMonitor.endActivity(); }
Source:
private void preRenderSetupSimpleBlendMaterials() { dynamicFBOsManager.get(DefaultDynamicFBOs.READ_ONLY_GBUFFER.getName()).setRenderBufferMask(true, true, true); GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // (*) GL11.glDepthMask(false); // (*) In this context SRC is Foreground. This effectively says: // Resulting RGB = ForegroundRGB * ForegroundAlpha + BackgroundRGB * (1 - ForegroundAlpha) // Which might still look complicated, but it's actually the most typical alpha-driven composite. // A neat tool to play with this settings can be found here: http://www.andersriggelsen.dk/glblendfunc.php }

Target:
private void preRenderSetupSimpleBlendMaterials() { READ_ONLY_GBUFFER.setRenderBufferMask(true, true, true); GL11.glEnable(GL_BLEND); GL11.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // (*) GL11.glDepthMask(false); // (*) In this context SRC is Foreground. This effectively says: // Resulting RGB = ForegroundRGB * ForegroundAlpha + BackgroundRGB * (1 - ForegroundAlpha) // Which might still look complicated, but it's actually the most typical alpha-driven composite. // A neat tool to play with this settings can be found here: http://www.andersriggelsen.dk/glblendfunc.php }
Source:
public SetFacesToCull(int mode) { if (mode != GL_BACK && mode != GL_FRONT && mode != GL_FRONT_AND_BACK) { throw new IllegalArgumentException("Mode must be GL_BACK, GL_FRONT or GL_FRONT_AND_BACK."); } this.mode = mode; }

Target:
public SetFacesToCull(int mode) { if (mode == GL_BACK || mode == GL_FRONT || mode == GL_FRONT_AND_BACK) { this.mode = mode; } else { throw new IllegalArgumentException("Mode must be GL_BACK, GL_FRONT or GL_FRONT_AND_BACK."); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); bindDisplay(); // TODO: verify this is necessary setViewportToSizeOf(READ_ONLY_GBUFFER); // TODO: verify this is necessary displayResolutionDependentFBOs.swapReadWriteBuffers(); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); // TODO: verify why we can't move the buffer attachment to before the swap by using WRITE_ONLY_GBUFFER instead. // TODO: See right-side streaks in https://cloud.githubusercontent.com/assets/136392/17794231/456f542a-65b6-11e6-83bb-f2cc3f10ee66.png PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/prePostComposite"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); displayResolutionDependentFBOs.swapReadWriteBuffers(); sceneReflectiveRefractive = displayResolutionDependentFBOs.get(REFLECTIVE_REFRACTIVE); READ_ONLY_GBUFFER.attachDepthBufferTo(sceneReflectiveRefractive); // TODO: verify why we can't move the buffer attachment to before the swap by using WRITE_ONLY_GBUFFER instead. // TODO: See right-side streaks in https://cloud.githubusercontent.com/assets/136392/17794231/456f542a-65b6-11e6-83bb-f2cc3f10ee66.png PerformanceMonitor.endActivity(); }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); bindDisplay(); // TODO: verify this is necessary PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/outline"); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // TODO: verify this is necessary renderFullscreenQuad(); PerformanceMonitor.endActivity(); }
Source:
public BindFBO(String fboName) { this.fboName = fboName; if (!fboName.equals(DEFAULT_FRAME_BUFFER_NAME)) { fboId = frameBuffersManager.getFBO(fboName).fboId; } else { fboId = DEFAULT_FRAME_BUFFER_ID; } }

Target:
public BindFBO(String fboName) { this.fboName = fboName; }
Source:
public String addNode(Node node, String suggestedId) { nodes.add(node); return null; // TODO: for instance if "blur" present make id "blur1" and return it }

Target:
public String addNode(Node node, String suggestedId) { nodes.add(node); return suggestedId; // TODO: for instance if "blur" present make id "blur1" and return it }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); if (renderingConfig.isSsao()) { // TODO: consider moving these into initialise without breaking existing implementation sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); } PerformanceMonitor.endActivity(); }

Target:
public void process() { if (renderingConfig.isSsao()) { PerformanceMonitor.startActivity("rendering/ambientocclusionpasses"); // TODO: consider moving these into initialise without breaking existing implementation sceneOpaque = frameBuffersManager.getFBO("sceneOpaque"); ssaoBlurredFBO = frameBuffersManager.getFBO("ssaoBlurred"); ssaoFBO = frameBuffersManager.getFBO("ssao"); generateSSAO(); generateBlurredSSAO(); PerformanceMonitor.endActivity(); } }
Source:
public void process() { PerformanceMonitor.startActivity("rendering/chunksrefractivereflective"); boolean isHeadUnderWater = worldRenderer.isHeadUnderWater(); preRenderSetupSceneReflectiveRefractive(isHeadUnderWater); worldRenderer.renderChunks(renderQueues.chunksAlphaBlend, ChunkMesh.RenderPhase.REFRACTIVE, playerCamera, WorldRendererImpl.ChunkRenderMode.DEFAULT); postRenderCleanupSceneReflectiveRefractive(isHeadUnderWater); PerformanceMonitor.endActivity(); }

Target:
public void process() { PerformanceMonitor.startActivity("rendering/chunksrefractivereflective"); // TODO: Eliminate this assignment isHeadUnderWater = worldRenderer.isHeadUnderWater(); preRenderSetupSceneReflectiveRefractive(); worldRenderer.renderChunks(renderQueues.chunksAlphaBlend, ChunkMesh.RenderPhase.REFRACTIVE, playerCamera, WorldRendererImpl.ChunkRenderMode.DEFAULT); postRenderCleanupSceneReflectiveRefractive(); PerformanceMonitor.endActivity(); }
Source:
void ensureCameraEntityCreated() { if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); mountCamera(); } }

Target:
private void ensureCameraEntityCreated() { if (!localPlayer.getCameraEntity().exists()) { ClientComponent clientComponent = localPlayer.getClientEntity().getComponent(ClientComponent.class); // create the camera from the prefab EntityBuilder builder = entityManager.newBuilder("engine:camera"); builder.setPersistent(false); clientComponent.camera = builder.build(); localPlayer.getClientEntity().saveComponent(clientComponent); } }
Source:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { deleteLogFiles(logFileFolder, ((int) Duration.ofDays(5).getSeconds())); } catch (IOException e) { e.printStackTrace(); } // Unfortunately, setting context-based variables works only after initialization // has completed. Manual initialization will work but is overriden by the first // (static) access to slf4j's StaticLoggerBinder. // This default initialization will attempt to create a folder "logFileFolder_IS_UNDEFINED" though. // TODO: file a report at logback/slf4j // LoggerContext context = new LoggerContext(); // context.setName(CoreConstants.DEFAULT_CONTEXT_NAME); // context.putProperty("targetFolder", pathString); // JoranConfigurator configurator = new JoranConfigurator(); // configurator.setContext(context); // // try { // ContextInitializer ci = new ContextInitializer(context); // ci.autoConfig(); // } catch (JoranException e) { // e.printStackTrace(); // } }

Target:
public static void initialize(Path logFileFolder) { String timestamp = TIMESTAMP_FORMAT.format(new Date()); loggingPath = logFileFolder.resolve(timestamp).normalize(); String pathString = loggingPath.toString(); System.setProperty(LOG_FILE_FOLDER, pathString); try { deleteLogFiles(logFileFolder, Duration.ofDays(5).getSeconds()); } catch (IOException e) { e.printStackTrace(); } // Unfortunately, setting context-based variables works only after initialization // has completed. Manual initialization will work but is overriden by the first // (static) access to slf4j's StaticLoggerBinder. // This default initialization will attempt to create a folder "logFileFolder_IS_UNDEFINED" though. // TODO: file a report at logback/slf4j // LoggerContext context = new LoggerContext(); // context.setName(CoreConstants.DEFAULT_CONTEXT_NAME); // context.putProperty("targetFolder", pathString); // JoranConfigurator configurator = new JoranConfigurator(); // configurator.setContext(context); // // try { // ContextInitializer ci = new ContextInitializer(context); // ci.autoConfig(); // } catch (JoranException e) { // e.printStackTrace(); // } }
Source:
public void onError(Throwable th) { LOGGER.info("---- onError\n" + th.toString()); lastPong = null; warnDisconnect(); executorService.shutdownNow(); }

Target:
public void onError(Throwable th) { LOGGER.info("---- onError\n" + th.toString()); lastPong = null; warnDisconnect(); if (executorService != null) { executorService.shutdownNow(); executorService = null; } }