auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected ConfigurableElement[] getConfigurableElements() { ConfigurableElement[] configurableElements = new ConfigurableElement[1]; configurableElements[0] = new ConfigurableElement() { @Override public String getName() { return "Enable CONSTRAINT-DRIVEN auth"; } @Override public void create(CLIWrapper cli) throws Exception { cli.sendLine("/subsystem=undertow/servlet-container=default:write-attribute(name=proactive-authentication, value=false)"); } @Override public void remove(CLIWrapper cli) throws Exception { <START> cli.sendLine("/subsystem=undertow/servlet-container=default:remove-attribute(name=proactive-authentication)"); <END> } }; return configurableElements; }</code><technical_language>'remove-attribute' op. 'undefine-attribute'</technical_language>

Target:
protected ConfigurableElement[] getConfigurableElements() { ConfigurableElement[] configurableElements = new ConfigurableElement[1]; configurableElements[0] = new ConfigurableElement() { @Override public String getName() { return "Enable CONSTRAINT-DRIVEN auth"; } @Override public void create(CLIWrapper cli) throws Exception { cli.sendLine("/subsystem=undertow/servlet-container=default:write-attribute(name=proactive-authentication, value=false)"); } @Override public void remove(CLIWrapper cli) throws Exception { cli.sendLine("/subsystem=undertow/servlet-container=default:undefine-attribute(name=proactive-authentication)"); } }; return configurableElements; }
Source:
<code>public Consumer<WebClient.Builder> oauth2Configuration() { <START> Hooks.onLastOperator(REQUEST_CONTEXT_OPERATOR_KEY, Operators.lift((s, sub) -> createRequestContextSubscriber(sub))); <END> return builder -> builder.defaultRequest(defaultRequest()).filter(this); }</code><technical_language>this implement DisposableBean clean hooks</technical_language>

Target:
public Consumer<WebClient.Builder> oauth2Configuration() { return builder -> builder.defaultRequest(defaultRequest()).filter(this); }
Source:
<code>public void applyRightFloor(final PatchSetApproval a) { final IdentifiedUser user = userFactory.create(a.getAccountId()); List<RefRight> actionRights = getAllRights(a.getCategoryId()); <START> boolean sameRefPattern = true; <END> List<RefRight> mostSpecific = RefControl.filterMostSpecific(actionRights); short minAllowed = 0, maxAllowed = 0; for (final RefRight r : mostSpecific) { final AccountGroup.Id grp = r.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { minAllowed = (short) Math.min(minAllowed, r.getMinValue()); maxAllowed = (short) Math.max(maxAllowed, r.getMaxValue()); } } if (a.getValue() < minAllowed) { a.setValue(minAllowed); dirty(a); } else if (a.getValue() > maxAllowed) { a.setValue(maxAllowed); dirty(a); } }</code><technical_language>unused</technical_language>

Target:
public void applyRightFloor(final PatchSetApproval a) { final IdentifiedUser user = userFactory.create(a.getAccountId()); List<RefRight> actionRights = getAllRights(a.getCategoryId()); List<RefRight> mostSpecific = RefControl.filterMostSpecific(actionRights); short minAllowed = 0, maxAllowed = 0; for (final RefRight r : mostSpecific) { final AccountGroup.Id grp = r.getAccountGroupId(); if (user.getEffectiveGroups().contains(grp)) { minAllowed = (short) Math.min(minAllowed, r.getMinValue()); maxAllowed = (short) Math.max(maxAllowed, r.getMaxValue()); } } if (a.getValue() < minAllowed) { a.setValue(minAllowed); dirty(a); } else if (a.getValue() > maxAllowed) { a.setValue(maxAllowed); dirty(a); } }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.EXEC_STATEMENT, ctx -> { PyExecStatement node = (PyExecStatement) ctx.syntaxNode(); PsiElement currentNode = node.getFirstChild().getNextSibling(); while (currentNode instanceof PsiWhiteSpace) { currentNode = currentNode.getNextSibling(); } <START> if (currentNode == null || !currentNode.getText().startsWith("(")) { <END> ctx.addIssue(node.getFirstChild(), "Do not use exec statement."); } }); }</code><technical_language>Suggestion: if (PsiTreeUtil.findChildOfType(ctx.syntaxNode(), PyParenthesizedExpression.class) == null) {</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(PyElementTypes.EXEC_STATEMENT, ctx -> { List<PyExpression> expressions = PsiTreeUtil.getChildrenOfTypeAsList(ctx.syntaxNode(), PyExpression.class); if (expressions.size() == 1 && expressions.get(0) instanceof PyParenthesizedExpression) { return; } ctx.addIssue(ctx.syntaxNode().getFirstChild(), "Do not use exec statement."); }); }
Source:
<code>private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); fAvailableElements = new ArrayList<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if (binding instanceof <START> ICPPField || <END> binding instanceof IVariable) { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations != null && declarations.length != 0 && accessibilityContext.isAccessible(binding)) { fAvailableElements.add(binding); } } } } } } } } finally { newContext.dispose(); } }</code><technical_language>I understand fields declared in current translation unit. disqualify field 'x' in example? header.h -------- class A { public: void foo(); void bar(int p); int x; }; test.cpp -------- #include "header.h" void A::foo() { bar(?); <- Is x proposed in this context? }</technical_language>

Target:
private void initializeDefinedElements(CContentAssistInvocationContext context) { int startOffset = getStatementStartOffset(context.getDocument(), context.getParseOffset() - fPrefix.length()); Map<String, IBinding> elementsMap = new HashMap<>(); IASTCompletionNode node = null; CContentAssistInvocationContext newContext = new CContentAssistInvocationContext( context.getViewer(), startOffset, context.getEditor(), true, false); try { node = newContext.getCompletionNode(); if (node != null) { IASTTranslationUnit tu = node.getTranslationUnit(); IASTName[] names = node.getNames(); for (IASTName name : names) { IASTCompletionContext astContext = name.getCompletionContext(); if (astContext != null) { IBinding[] bindings = astContext.findBindings(name, true); if (bindings != null) { AccessContext accessibilityContext = new AccessContext(name); for (IBinding binding : bindings) { if ((binding instanceof ICPPField || binding instanceof IVariable) && accessibilityContext.isAccessible(binding) && !elementsMap.containsKey(binding.getName())) { if (binding instanceof ICPPField) { elementsMap.put(binding.getName(), binding); } else { IASTName[] declarations = tu.getDeclarationsInAST(binding); if (declarations != null && declarations.length != 0) elementsMap.put(binding.getName(), binding); } } } } } } } } finally { fAvailableElements = new ArrayList<>(elementsMap.values()); newContext.dispose(); } }
Source:
<code>public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); dataSource = createDataSource(); <START> init(); <END> }</code><technical_language>I need do this. add a method public void init(T data) { render(data); } places need call this Dialog this data i.e. need call init parameters needs reuse data initialized with? If not, init(T data) approach work fine</technical_language>

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); dataSource = createDataSource(); startLoad(dataSource, getLoaderId(), this); }
Source:
<code>public static IntervalList fromPath(final Path path) { final IntervalList list; try (final BufferedReader reader = IOUtil.openFileForBufferedReading(path)) { <START> list = fromReader(reader); <END> } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path.toUri().toString())); } return list; }</code><technical_language>avoid creating local variable write suggestion return fromReader(reader);</technical_language>

Target:
public static IntervalList fromPath(final Path path) { try (final BufferedReader reader = IOUtil.openFileForBufferedReading(path)) { return fromReader(reader); } catch (final IOException e) { throw new SAMException(String.format("Failed to close file %s after reading", path.toUri().toString())); } }
Source:
<code>public CacheOperationResult<CacheEntry<String,String>> get(final @QueryParam("key") String key) { final Cache<String, String> cache; final CacheOperationResult<CacheEntry<String,String>> cor = new CacheOperationResult<CacheEntry<String,String>>(); Subject subject = SecurityContextAssociation.getSubject(); try { cache = cm.getCache("secured"); <START> Subject.doAs(subject, new PrivilegedAction<Void>() { <END> public Void run() { ArrayList<CacheEntry<String, String>> cacheEntries = new ArrayList<CacheEntry<String, String>>(); if (key == null) { Set<Map.Entry<String, String>> entries = cache.entrySet(); for (Map.Entry<String, String> entry : entries) { cacheEntries.add(new CacheEntry<String, String>(entry.getKey(), entry.getValue())); } } else { String value = cache.get(key); if (value != null) cacheEntries.add(new CacheEntry<String, String>(key, value)); } Collections.sort(cacheEntries); cor.setOutputEntries(cacheEntries); return null; } }); } catch(Exception e) { cor.setFailed(true); cor.setFailureMessage(e.getMessage()); } return cor; }</code><technical_language>Update Security.doAs</technical_language>

Target:
public CacheOperationResult<CacheEntry<String,String>> get(final @QueryParam("key") String key) { final CacheOperationResult<CacheEntry<String,String>> cor = new CacheOperationResult<CacheEntry<String,String>>(); Subject subject = SecurityContextAssociation.getSubject(); try { Security.doAs(subject, new PrivilegedAction<Void>() { public Void run() { Cache<String, String> cache; cache = cm.getCache("secured"); ArrayList<CacheEntry<String, String>> cacheEntries = new ArrayList<CacheEntry<String, String>>(); if (key == null) { Set<Map.Entry<String, String>> entries = cache.entrySet(); for (Map.Entry<String, String> entry : entries) { cacheEntries.add(new CacheEntry<String, String>(entry.getKey(), entry.getValue())); } } else { String value = cache.get(key); if (value != null) cacheEntries.add(new CacheEntry<String, String>(key, value)); } Collections.sort(cacheEntries); cor.setOutputEntries(cacheEntries); return null; } }); } catch(Exception e) { cor.setFailed(true); cor.setFailureMessage(e.getMessage()); } return cor; }
Source:
<code>NetworkBroadcastReceiver(Context context) { <START> this.connectivityManager = <END> (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); }</code><technical_language>If drop this. fit line</technical_language>

Target:
NetworkBroadcastReceiver(Context context) { connectivityManager = (ConnectivityManager) context.getSystemService(CONNECTIVITY_SERVICE); }
Source:
<code>public void testAssignServerIp() { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); FirewallPolicy.ServerIp.CreateServerIp toAdd = FirewallPolicy.ServerIp.CreateServerIp.create(ips); FirewallPolicy updateResult = firewallPolicyApi().assignServerIp(currentFirewallPolicy.id(), toAdd); <START> assertNotNull(updateResult); <END> }</code><technical_language>Is a more solid test result of operation is expected one</technical_language>

Target:
public void testAssignServerIp() { assertNodeAvailable(currentServer); currentServer = updateServerStatus(currentServer); List<String> ips = new ArrayList<String>(); ips.add(currentServer.ips().get(0).id()); FirewallPolicy.ServerIp.CreateServerIp toAdd = FirewallPolicy.ServerIp.CreateServerIp.create(ips); FirewallPolicy updateResult = firewallPolicyApi().assignServerIp(currentFirewallPolicy.id(), toAdd); assertEquals(updateResult.serverIps().get(0).id(), currentServer.ips().get(0).id()); assertNotNull(updateResult); }
Source:
<code>public Object deserialize(Writable blob) throws SerDeException { Object row; Text t; if (blob instanceof BytesWritable) { <START> t = new Text(((BytesWritable) blob).getBytes()); <END> } else { t = (Text) blob; } try { row = structReader.parseStruct(new ByteArrayInputStream((t.getBytes()), 0, t.getLength())); return row; } catch (Exception e) { LOG.warn("Error parsing json text [{}].", e, t); throw new SerDeException(e); } }</code><technical_language>i this add extra copy of data. wrap BytesWritable produce byte stream a copy</technical_language>

Target:
public Object deserialize(Writable blob) throws SerDeException { String st = null; try { if (blob instanceof BytesWritable) { byte[] rowByteArr = ((BytesWritable) blob).getBytes(); st = Text.decode(rowByteArr, 0, rowByteArr.length).trim(); } else { st = blob.toString().trim(); } return structReader.parseStruct(new ByteArrayInputStream((st.getBytes()), 0, st.getBytes().length)); } catch (Exception e) { LOG.warn("Error parsing json text [{}].", e, st); throw new SerDeException(e); } }
Source:
<code>public Program getAssociatedProgram(Artifact artifact) { String extension = getAssociatedExtension(artifact); Program program = <START> ProgramFinder.findProgram(extension.toLowerCase()); <END> if (program == null) { throw new OseeArgumentException("No program associated with the extension [%s] found on your local machine.", extension); } return program; }</code><technical_language>Perform this operation in custom ProgramFinder.findProgram() method instead</technical_language>

Target:
public Program getAssociatedProgram(Artifact artifact) { String extension = getAssociatedExtension(artifact); Program program = ProgramFinder.findProgram(extension); if (program == null) { throw new OseeArgumentException("No program associated with the extension [%s] found on your local machine.", extension); } return program; }
Source:
<code>private int decompressDirectBuf() { if (compressedDirectBufLen == 0) { <START> return 0; <END> } else { compressedDirectBuf.limit(compressedDirectBufLen).position(0); lz4Decompressor.decompress((ByteBuffer) compressedDirectBuf, (ByteBuffer) uncompressedDirectBuf); compressedDirectBufLen = 0; compressedDirectBuf.limit(compressedDirectBuf.capacity()).position(0); int size = uncompressedDirectBuf.position(); uncompressedDirectBuf.position(0); return size; } }</code><technical_language>I this happen a big deal</technical_language>

Target:
private int decompressDirectBuf() { if (compressedDirectBufLen == 0) { return 0; } else { compressedDirectBuf.limit(compressedDirectBufLen).position(0); lz4Decompressor.decompress((ByteBuffer) compressedDirectBuf, (ByteBuffer) uncompressedDirectBuf); compressedDirectBufLen = 0; compressedDirectBuf.clear(); int size = uncompressedDirectBuf.position(); uncompressedDirectBuf.position(0); return size; } }
Source:
<code>private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList.add( new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); } else { <START> logger.trace("Received response for a request that timed out"); <END> } } }</code><technical_language>in code updates connectionIdToRequestInFlight queue a request timed out</technical_language>

Target:
private void handleSelectorEvents(List<ResponseInfo> responseInfoList) { for (String connId : selector.connected()) { connectionTracker.checkInConnection(connId); } for (String connId : selector.disconnected()) { connectionTracker.removeConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); if (requestMetadata != null) { responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), NetworkClientErrorCode.NetworkError, null)); } } for (NetworkReceive recv : selector.completedReceives()) { String connId = recv.getConnectionId(); connectionTracker.checkInConnection(connId); RequestMetadata requestMetadata = connectionIdToRequestInFlight.remove(connId); responseInfoList .add(new ResponseInfo(requestMetadata.requestInfo.getRequest(), null, recv.getReceivedBytes().getPayload())); } }
Source:
<code>public void testTruncateToLengthAndTrimSpaces() { <START> assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 1)); <END> assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a "), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("abc"), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 0)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 3)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(" "), 1)); }</code><technical_language>I meant cases space end initially. too</technical_language>

Target:
public void testTruncateToLengthAndTrimSpaces() { assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("a "), 1)); assertEquals(utf8Slice("a"), truncateToLengthAndTrimSpaces(utf8Slice("abc"), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice("a c"), 0)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 3)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 4)); assertEquals(utf8Slice("a c"), truncateToLengthAndTrimSpaces(utf8Slice("a c "), 5)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(" "), 1)); assertEquals(utf8Slice(""), truncateToLengthAndTrimSpaces(utf8Slice(""), 1)); }
Source:
<code>public void subscribe_to_topic() { final BoundedContext boundedContext = setupBoundedContextForAggregateRepo(); final SubscriptionService subscriptionService = SubscriptionService.newBuilder() .addBoundedContext(boundedContext) .build(); final String type = boundedContext.getStand() .getAvailableTypes() .iterator() .next() .getTypeName(); <START> final Target target = Target.newBuilder() <END> .setType(type) .build(); final Topic topic = Topic.newBuilder() .setTarget(target) .build(); final MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(topic, observer); assertNotNull(observer.streamFlowValue); assertTrue(observer.streamFlowValue.isInitialized()); assertEquals(observer.streamFlowValue.getType(), type); assertNull(observer.throwable); assertTrue(observer.isCompleted); }</code><technical_language>Consider Queries.Targets#<something> instead</technical_language>

Target:
public void subscribe_to_topic() { final BoundedContext boundedContext = setupBoundedContextForAggregateRepo(); final SubscriptionService subscriptionService = SubscriptionService.newBuilder() .addBoundedContext(boundedContext) .build(); final String type = boundedContext.getStand() .getAvailableTypes() .iterator() .next() .getTypeName(); final Target target = getProjectQueryTarget(); assertEquals(type, target.getType()); final Topic topic = Topic.newBuilder() .setTarget(target) .build(); final MemoizeStreamObserver<Subscription> observer = new MemoizeStreamObserver<>(); subscriptionService.subscribe(topic, observer); assertNotNull(observer.streamFlowValue); assertTrue(observer.streamFlowValue.isInitialized()); assertEquals(observer.streamFlowValue.getType(), type); assertNull(observer.throwable); assertTrue(observer.isCompleted); }
Source:
<code><START> public XBee64BitAddress(String address) { <END> byte[] byteAddress = HexUtils.hexStringToByteArray(address); this.address = new byte[8]; int diff = 8 - byteAddress.length; for (int i = 0; i < diff; i++) this.address[i] = 0; for (int i = diff; i < 8; i++) this.address[i] = byteAddress[i - diff]; }</code><technical_language>Throw a NullPointerException if address is null</technical_language>

Target:
public XBee64BitAddress(String address) { if (address == null) throw new NullPointerException("Address cannot be null."); byte[] byteAddress = HexUtils.hexStringToByteArray(address); this.address = new byte[8]; int diff = 8 - byteAddress.length; for (int i = 0; i < diff; i++) this.address[i] = 0; for (int i = diff; i < 8; i++) this.address[i] = byteAddress[i - diff]; }
Source:
<code>private int distToInt(double distance) { <START> if (distance < 0) <END> throw new IllegalArgumentException("Distance cannot be negative: " + distance); if (distance > MAX_DIST) { distance = MAX_DIST; } int integ = Math.round((float) (distance * INT_DIST_FACTOR)); assert integ >= 0 : "distance out of range"; return integ; }</code><technical_language>problem is do handle negative integers in getDist yet: val / INT_DIST_FACTOR I prefer this check early possible. #1544</technical_language>

Target:
private int distToInt(double distance) { if (distance < 0) throw new IllegalArgumentException("Distance cannot be negative: " + distance); if (distance > MAX_DIST) { distance = MAX_DIST; } int integ = (int) Math.round(distance * INT_DIST_FACTOR); assert integ >= 0 : "distance out of range"; return integ; }
Source:
<code>public String toString() { <START> return "Add new Resource adapter: " + id; <END> }</code><technical_language>I providing toString, people :-), common pattern is "CommandClassName $someIdentifierIfExists". In this case, expect return "AddResourceAdapter " + id;</technical_language>

Target:
public String toString() { return "AddResourceAdapter " + id; }
Source:
<code>public void testOverwriteRotate() throws Exception { final Calendar cal = Calendar.getInstance(); <START> final String rotatedPath = BASE_LOG_DIR.toString() + "/" + FILENAME + rotateFormatter.format(cal.getTime()); <END> File rotatedFile = new File(rotatedPath); if (rotatedFile.exists()) rotatedFile.delete(); try { FileWriter fwriter = new FileWriter(rotatedFile.getAbsolutePath()); BufferedWriter writer = new BufferedWriter(fwriter); writer.write("Adding data to the file"); writer.close(); } catch (Exception e) { e.printStackTrace(); } testRotate(cal, rotatedFile); }</code><technical_language>java.io.File.separator</technical_language>

Target:
public void testOverwriteRotate() throws Exception { final Calendar cal = Calendar.getInstance(); final String rotatedPath = BASE_LOG_DIR.toString() + File.separator + FILENAME + rotateFormatter.format(cal.getTime()); File rotatedFile = new File(rotatedPath); if (rotatedFile.exists()) { rotatedFile.delete(); } FileWriter fwriter = null; BufferedWriter writer = null; try { fwriter = new FileWriter(rotatedFile.getAbsolutePath()); writer = new BufferedWriter(fwriter); writer.write("Adding data to the file"); } finally { writer.close(); } testRotate(cal, rotatedFile); }
Source:
<code>public static void main(String[] argv) throws FileNotFoundException { File file = new File("./dg-spark/src/main/resources/file/input.txt"); InputStream is = new FileInputStream(file); RandomNumberEngine randomNumberEngine = new RandomNumberEngine(); <START> randomNumberEngine.setModelByInputFileStream(is); <END> String masterURL = "spark://sandbox.hortonworks.com:7077"; SparkDistributor sparkDistributor = new SparkDistributor(masterURL); randomNumberEngine.process(sparkDistributor); }</code><technical_language>File closed. processes input stream wrapped in a try, in a finally block close input stream</technical_language>

Target:
public static void main(String[] argv) throws IOException { File file = new File("./dg-spark/src/main/resources/file/input.txt"); InputStream is = new FileInputStream(file); try { RandomNumberEngine randomNumberEngine = new RandomNumberEngine(); randomNumberEngine.setModelByInputFileStream(is); String masterURL = "spark://sandbox.hortonworks.com:7077"; ScalaDataConsumer scalaDataConsumer = new ScalaDataConsumer(); SparkDistributor sparkDistributor = new SparkDistributor(masterURL, scalaDataConsumer); randomNumberEngine.process(sparkDistributor); } finally { is.close(); } }
Source:
<code>public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); <START> DEBUG_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); <END> }</code><technical_language>is correct current debug timeouts printed. However, I if enable debug timeouts if DEBUG is on. tracing is org.eclipse.cdt.dsf.gdb/debug/timeouts, implies is dependent org.eclipse.cdt.dsf.gdb/debug. line DEBUG_TIMEOUTS = DEBUG && options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); ask Mikhail wants do for this, is feature</technical_language>

Target:
public void optionsChanged(DebugOptions options) { fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); DEBUG = options.getBooleanOption(DEBUG_FLAG, false); DEBUG_COMMAND_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); }
Source:
<code>public void testSimpleQueryWithProxyRegion() { server1.invoke(() -> setupReplicatedProxyRegion(DATA_REGION_WITH_PROXY_NAME)); server2.invoke(() -> setupReplicatedRegion(DATA_REGION_WITH_PROXY_NAME)); locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_WITH_PROXY_NAME_PATH, 2); server1.invoke(() -> prepareDataForRegion(DATA_REGION_WITH_PROXY_NAME_PATH)); String member = getHostingMember(); Random random = new Random(System.nanoTime()); int randomInteger = random.nextInt(COUNT); <START> String query = "query --member=" + member + " --query=\"select ID , status , createTime , pk, floatMinValue from " + DATA_REGION_WITH_PROXY_NAME_PATH + " where ID <= " + randomInteger + "\" --interactive=false"; <END> CommandResult commandResult = gfsh.executeCommand(query); validateSelectResult(commandResult, true, (randomInteger + 1), new String[] {"ID", "status", "createTime", "pk", "floatMinValue"}); }</code><technical_language>this CommandStringBuilder? easier read in experience</technical_language>

Target:
public void testSimpleQueryWithProxyRegion() { server1.invoke(() -> setupReplicatedProxyRegion(DATA_REGION_WITH_PROXY_NAME)); server2.invoke(() -> setupReplicatedRegion(DATA_REGION_WITH_PROXY_NAME)); locator.waitUntilRegionIsReadyOnExactlyThisManyServers(DATA_REGION_WITH_PROXY_NAME_PATH, 2); server1.invoke(() -> prepareDataForRegion(DATA_REGION_WITH_PROXY_NAME_PATH)); String member = "server-2"; Random random = new Random(System.nanoTime()); int randomInteger = random.nextInt(COUNT); String queryString = new StringBuilder() .append("\"select ID , status , createTime , pk, floatMinValue from ") .append(DATA_REGION_WITH_PROXY_NAME_PATH).append(" where ID <= ") .append(randomInteger).append("\"").toString(); String command = new CommandStringBuilder(QUERY) .addOption(MEMBER, member) .addOption(QUERY, queryString).getCommandString(); CommandResult commandResult = gfsh.executeAndAssertThat(command).getCommandResult(); validateSelectResult(commandResult, true, (randomInteger + 1), new String[] {"ID", "status", "createTime", "pk", "floatMinValue"}); }
Source:
<code>public void handleEvent(IExitedDMEvent event) { IDMContext context = event.getDMContext(); if (context instanceof IContainerDMContext) { DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), context.getSessionId()); IProcesses procService = tracker.getService(IProcesses.class); tracker.dispose(); procService.getProcessesBeingDebugged(context, new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { assert getData() != null; IDMContext[] contexts = getData(); for (IDMContext c : contexts) { if (c instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)c).getThreadId(); fVisualizer.getModel().markThreadExited(tid); } <START> } <END> } }); } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); fVisualizer.getModel().markThreadExited(tid); MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas(); if (canvas != null) { canvas.requestUpdate(); } } }</code><technical_language>Do need call canvas.requestUpdate() here, do below</technical_language>

Target:
public void handleEvent(IExitedDMEvent event) { IDMContext context = event.getDMContext(); MulticoreVisualizerCanvas canvas = fVisualizer.getMulticoreVisualizerCanvas(); if (context instanceof IContainerDMContext) { DsfServicesTracker tracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), context.getSessionId()); IProcesses procService = tracker.getService(IProcesses.class); tracker.dispose(); procService.getProcessesBeingDebugged(context, new ImmediateDataRequestMonitor<IDMContext[]>() { @Override protected void handleSuccess() { assert getData() != null; IDMContext[] contexts = getData(); for (IDMContext c : contexts) { if (c instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)c).getThreadId(); fVisualizer.getModel().markThreadExited(tid); } } } }); if (canvas != null) { canvas.requestUpdate(); } } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); fVisualizer.getModel().markThreadExited(tid); if (canvas != null) { canvas.requestUpdate(); } } }
Source:
<code>public void sendToStomp(StompFrame command) throws IOException { try { <START> ByteArrayOutputStream baos = new ByteArrayOutputStream(); <END> DataOutputStream dos = new DataOutputStream(baos); getWireFormat().marshal(command, dos); dos.close(); ByteBuffer byteBuffer = ByteBuffer.wrap(baos.toByteArray()); session.getRemote().sendBytesByFuture(byteBuffer).get(getDefaultSendTimeOut(), TimeUnit.SECONDS); } catch (Exception e) { throw IOExceptionSupport.create(e); } }</code><technical_language>if is issue.. this dead slow for server... if issues this.. this fix is good anyways. Tim said.. need a test</technical_language>

Target:
public void sendToStomp(StompFrame command) throws IOException { try { session.getRemote().sendStringByFuture(getWireFormat().marshalToString(command)).get(getDefaultSendTimeOut(), TimeUnit.SECONDS); } catch (Exception e) { throw IOExceptionSupport.create(e); } }
Source:
<code>private static JSITDMNElement.JSIExtensionElements getOrCreateExtensionElements(final JSITDRGElement target) { JSITDMNElement.JSIExtensionElements toReturn = target.getExtensionElements() == null ? new JSITDMNElement.JSIExtensionElements() : target.getExtensionElements(); if (!Objects.isNull(toReturn) && Objects.isNull(toReturn.getAny())) { <START> toReturn.setAny(new ArrayList<>()); <END> } return toReturn; }</code><technical_language>Collections.emptyList() asking, do knwo if troubles return no-modifiable list</technical_language>

Target:
private static JSITDMNElement.JSIExtensionElements getOrCreateExtensionElements(final JSITDRGElement target) { JSITDMNElement.JSIExtensionElements toReturn = Objects.isNull(target.getExtensionElements()) ? new JSITDMNElement.JSIExtensionElements() : target.getExtensionElements(); if (!Objects.isNull(toReturn) && Objects.isNull(toReturn.getAny())) { toReturn.setAny(new ArrayList<>()); } return toReturn; }
Source:
<code>private List<BRLConditionVariableColumn> convertInterpolationVariables(Map<InterpolationVariable, Integer> ivs) { if (ivs.isEmpty()) { BRLConditionVariableColumn variable = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); List<BRLConditionVariableColumn> variables = new ArrayList<BRLConditionVariableColumn>(); variables.add(variable); return variables; } BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ivs.size()]; for (Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet()) { InterpolationVariable iv = me.getKey(); int index = me.getValue(); BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); <START> variable.setOperator(iv.getOperator()); <END> variables[index] = variable; } List<BRLConditionVariableColumn> variableList = new ArrayList<BRLConditionVariableColumn>(); for (BRLConditionVariableColumn variable : variables) { variableList.add(variable); } return variableList; }</code><technical_language>initialization of variable is split iv in constructor editingCol in additional setters. This change follow this kind of confusing do think. I expect of below: java BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField(), iv.getOperator()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); java BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); variable.setOperator(editiongCol.getOperator()); do</technical_language>

Target:
private List<BRLConditionVariableColumn> convertInterpolationVariables(Map<InterpolationVariable, Integer> ivs) { if (ivs.isEmpty()) { BRLConditionVariableColumn variable = new BRLConditionVariableColumn("", DataType.TYPE_BOOLEAN); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); List<BRLConditionVariableColumn> variables = new ArrayList<BRLConditionVariableColumn>(); variables.add(variable); return variables; } BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ivs.size()]; for (Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet()) { InterpolationVariable iv = me.getKey(); int index = me.getValue(); BRLConditionVariableColumn variable = new BRLConditionVariableColumn(iv.getVarName(), iv.getDataType(), iv.getFactType(), iv.getFactField(), iv.getOperator()); variable.setHeader(editingCol.getHeader()); variable.setHideColumn(editingCol.isHideColumn()); variables[index] = variable; } List<BRLConditionVariableColumn> variableList = new ArrayList<BRLConditionVariableColumn>(); for (BRLConditionVariableColumn variable : variables) { variableList.add(variable); } return variableList; }
Source:
<code>public AuditLogType getAuditLogTypeValue() { addCustomValue(LOGABLE_FIELD_CPU_LIMIT, String.valueOf((int) getParameters().getSlaParameter(VmSlaPolicyParameters.Params.CPU_LIMIT))); if (getSucceeded()) { return AuditLogType.VM_SLA_POLICY; } else { <START> addCustomValue(LOGABLE_FIELD_ERROR_MESSAGE, getReturnValue().getFault().getMessage()); <END> return AuditLogType.FAILED_VM_SLA_POLICY; } }</code><technical_language>Fault in getReturnValue() is set in execute method now, hold in class member something.</technical_language>

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue(LOGABLE_FIELD_CPU_LIMIT, String.valueOf(getParameters().getCpuLimit())); return getSucceeded() ? AuditLogType.VM_SLA_POLICY : AuditLogType.FAILED_VM_SLA_POLICY; }
Source:
<code>public SingularityWebhookAuthenticator(@Named(SingularityAuthModule.WEBHOOK_AUTH_HTTP_CLIENT) AsyncHttpClient asyncHttpClient, SingularityConfiguration configuration, ObjectMapper objectMapper) { this.asyncHttpClient = asyncHttpClient; this.webhookAuthConfiguration = configuration.getWebhookAuthConfiguration(); this.objectMapper = objectMapper; this.permissionsCache = CacheBuilder.<String, SingularityUserPermissionsResponse>newBuilder() .refreshAfterWrite(webhookAuthConfiguration.getCacheValidationMs(), TimeUnit.MILLISECONDS) .build(new CacheLoader<String, SingularityUserPermissionsResponse>() { @Override <START> public SingularityUserPermissionsResponse load(String authHeaderVaule) throws Exception { <END> return verifyUncached(authHeaderVaule); } @Override public ListenableFuture<SingularityUserPermissionsResponse> reload(String authHeaderVaule, SingularityUserPermissionsResponse oldVaule) { return ListenableFutureTask.create(() -> { try { return verifyUncached(authHeaderVaule); } catch (Throwable t) { return oldVaule; } }); } }); }</code><technical_language>s/authHeaderVaule/authHeaderValue</technical_language>

Target:
public SingularityWebhookAuthenticator(@Named(SingularityAuthModule.WEBHOOK_AUTH_HTTP_CLIENT) AsyncHttpClient asyncHttpClient, SingularityConfiguration configuration, ObjectMapper objectMapper) { this.asyncHttpClient = asyncHttpClient; this.webhookAuthConfiguration = configuration.getWebhookAuthConfiguration(); this.objectMapper = objectMapper; this.permissionsCache = CacheBuilder.<String, SingularityUserPermissionsResponse>newBuilder() .refreshAfterWrite(webhookAuthConfiguration.getCacheValidationMs(), TimeUnit.MILLISECONDS) .build(new CacheLoader<String, SingularityUserPermissionsResponse>() { @Override public SingularityUserPermissionsResponse load(String authHeaderValue) throws Exception { return verifyUncached(authHeaderValue); } @Override public ListenableFuture<SingularityUserPermissionsResponse> reload(String authHeaderVaule, SingularityUserPermissionsResponse oldVaule) { return ListenableFutureTask.create(() -> { try { return verifyUncached(authHeaderVaule); } catch (Throwable t) { LOG.warn("Unable to refresh user information", t); return oldVaule; } }); } }); }
Source:
<code><START> public int read(ScatteringByteChannel channel) throws IOException { <END> expectIncomplete(); int read = 0; if (sizeBuffer.remaining() > 0) { read += channel.read(sizeBuffer); } if (contentBuffer == null && !sizeBuffer.hasRemaining()) { sizeBuffer.rewind(); int size = sizeBuffer.getInt(); if (size <= 0) { throw new IOException(format("%d is not a valid request size.", size)); } contentBuffer = byteBufferAllocate(size); } if (contentBuffer != null) { read = channel.read(contentBuffer); if (!contentBuffer.hasRemaining()) { contentBuffer.rewind(); complete = true; } } return read; }</code><technical_language>suggest rewrite this method</technical_language>

Target:
public int read(ScatteringByteChannel channel) throws IOException { int read = 0; if (sizeBuffer.hasRemaining()) { int num = channel.read(sizeBuffer); if (num < 0) { throw new IOException("end-of-stream reached"); } read += num; if (sizeBuffer.hasRemaining()) { return read; } else { sizeBuffer.flip(); size = sizeBuffer.getInt(); contentBuffer = ByteBuffer.allocate(size); } } if (!sizeBuffer.hasRemaining()) { int num = channel.read(contentBuffer); if (num < 0) { throw new IOException("end-of-stream reached"); } read += num; if (!contentBuffer.hasRemaining()) { contentBuffer.flip(); complete = true; } } return read; }
Source:
<code>private void speakArticle() { TextToSpeech tts = getPageActivity().getTTSEngine(); MenuItem speechArticle = mOptionsMenu.findItem(R.id.menu_page_tts); if (tts.isSpeaking()) { stopSpeakArticle(tts); } else { speechArticle.setTitle(R.string.tts_stop_read_aloud); <START> Locale lang = Locale.forLanguageTag(getTitle().getSite().getLanguageCode()); <END> if (tts.isLanguageAvailable(lang) == TextToSpeech.LANG_AVAILABLE) { tts.setLanguage(lang); L.d("Set TTS language to: " + lang.getDisplayLanguage()); } else { FeedbackUtil.showMessage(getActivity(), R.string.tts_lang_not_available); return; } tts.speak(Html.fromHtml(getPage().getDisplayTitle()).toString(), TextToSpeech.QUEUE_ADD, null, null); List<Section> sections = getPage().getSections(); for (Section section : sections) { addToSpeakQueue(Html.fromHtml(section.getHeading() + " " + section.getContent()).toString(), tts); } Bundle params = new Bundle(); params.putString(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, getPage().getDisplayTitle()); tts.speak("", TextToSpeech.QUEUE_ADD, params, getPage().getDisplayTitle()); } }</code><technical_language>Android Studio highlights new API usage in yellow easy miss. Locale.forLanguageTag is API 21+. I new Locale(getTitle().getSite().getLanguageCode()) work platform</technical_language>

Target:
private void speakArticle() { TextToSpeech tts = getPageActivity().getTTSEngine(); if (tts.isSpeaking()) { stopSpeakArticle(tts); } else { Locale lang = Locale.forLanguageTag(getTitle().getSite().getLanguageCode()); if (tts.isLanguageAvailable(lang) == TextToSpeech.LANG_AVAILABLE) { tts.setLanguage(lang); L.d("Set TTS language to: " + lang.getDisplayLanguage()); } else { FeedbackUtil.showMessage(getActivity(), R.string.tts_lang_not_available); return; } addToSpeakQueue(Html.fromHtml(getPage().getDisplayTitle()).toString(), tts); List<Section> sections = getPage().getSections(); for (Section section : sections) { addToSpeakQueue(Html.fromHtml(section.getHeading() + " " + section.getContent()).toString(), tts); } HashMap<String, String> params = new HashMap(); params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, getPage().getDisplayTitle()); speak("", params, tts); invalidateOptionsMenu(); } }
Source:
<code>void onConnectionError(Throwable exception) { <START> logger.warning("Connection exception encountered: " + exception, exception); <END> }</code><technical_language>this a parameterized message? java logger.warning("Connection exception encountered: {}", exception); Right this log exception message twice</technical_language>

Target:
void onConnectionError(Throwable exception) { logger.warning("Connection exception encountered.", exception); }
Source:
<code>public static void tearDownTestCase() throws Exception { if(dataSource != null) { Connection con = dataSource.getConnection(); if(con != null) { <START> con.rollback(); <END> } } }</code><technical_language>Rollback done test case (i.e., @After notation, @AfterClass notataion), I preserve current behavior od tearDownTestCase(). I suggest creating a new tearDown() method for performing rollback</technical_language>

Target:
public static void tearDownTestCase() throws Exception { }
Source:
<code>public Http2BlockingChannel(String hostName, int port, SSLConfig sslConfig, Http2ClientConfig http2ClientConfig, Http2ClientMetrics http2ClientMetrics) { NettySslHttp2Factory nettySslHttp2Factory; try { nettySslHttp2Factory = new NettySslHttp2Factory(sslConfig); } catch (GeneralSecurityException | IOException e) { throw new IllegalStateException("Can't create NettySslHttp2Factory: ", e); } this.http2ClientConfig = http2ClientConfig; this.http2ClientMetrics = http2ClientMetrics; this.http2MultiplexedChannelPool = new Http2MultiplexedChannelPool(new InetSocketAddress(hostName, port), nettySslHttp2Factory, Epoll.isAvailable() ? new EpollEventLoopGroup() : new NioEventLoopGroup(), http2ClientConfig, <START> http2ClientMetrics, <END> new Http2BlockingChannelStreamChannelInitializer(http2ClientConfig.http2MaxContentLength)); }</code><technical_language>nit: http2ClientMetrics is in this class, need a reference of this object in this class</technical_language>

Target:
public Http2BlockingChannel(String hostName, int port, SSLConfig sslConfig, Http2ClientConfig http2ClientConfig, Http2ClientMetrics http2ClientMetrics) { NettySslHttp2Factory nettySslHttp2Factory; try { nettySslHttp2Factory = new NettySslHttp2Factory(sslConfig); } catch (GeneralSecurityException | IOException e) { throw new IllegalStateException("Can't create NettySslHttp2Factory: ", e); } this.http2ClientConfig = http2ClientConfig; this.http2MultiplexedChannelPool = new Http2MultiplexedChannelPool(new InetSocketAddress(hostName, port), nettySslHttp2Factory, Epoll.isAvailable() ? new EpollEventLoopGroup() : new NioEventLoopGroup(), http2ClientConfig, http2ClientMetrics, new Http2BlockingChannelStreamChannelInitializer(http2ClientConfig.http2MaxContentLength)); }
Source:
<code>private void skipIntro(Playable playable) { int skipIntro = 0; if (! (playable instanceof FeedMedia)) { return; } <START> if (playable.getLastPlayedTime() > 0) { <END> return; } if (playable instanceof FeedMedia) { FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); skipIntro = preferences.getFeedSkipIntro(); } String skipIntroMesg = ""; Context context = getApplicationContext(); if (skipIntro > 0) { int duration = getDuration(); if (skipIntro * 1000 < duration) { mediaPlayer.seekTo(skipIntro * 1000); skipIntroMesg = context.getString(R.string.pref_feed_skip_intro_toast, skipIntro, context.getString(R.string.time_seconds)); } } if (skipIntroMesg != "") { Toast toast = Toast.makeText(context, skipIntroMesg, Toast.LENGTH_LONG); toast.show(); } }</code><technical_language>this intro is skipped if play for time</technical_language>

Target:
private void skipIntro(Playable playable) { if (! (playable instanceof FeedMedia)) { return; } FeedMedia feedMedia = (FeedMedia) playable; FeedPreferences preferences = feedMedia.getItem().getFeed().getPreferences(); int skipIntro = preferences.getFeedSkipIntro(); Context context = getApplicationContext(); if (skipIntro > 0 && playable.getPosition() < skipIntro * 1000) { int duration = getDuration(); if (skipIntro * 1000 < duration) { Log.d(TAG, "skipIntro " + playable.getEpisodeTitle()); mediaPlayer.seekTo(skipIntro * 1000); String skipIntroMesg = context.getString(R.string.pref_feed_skip_intro_toast, skipIntro); Toast toast = Toast.makeText(context, skipIntroMesg, Toast.LENGTH_LONG); toast.show(); } } }
Source:
<code>public void activate(final BundleContext bundleContext, final Map<String, Object> config) { logger.debug("influxdb persistence service activated"); disconnect(); password = (String) config.get("password"); <START> if (StringUtils.isBlank(password)) { <END> isProperlyConfigured = false; logger .error("influxdb:password", "The password is missing. To specify a password configure the password parameter in openhab.cfg."); return; } url = (String) config.get("url"); if (StringUtils.isBlank(url)) { url = DEFAULT_URL; logger.debug("using default url {}", DEFAULT_URL); } user = (String) config.get("user"); if (StringUtils.isBlank(user)) { user = DEFAULT_USER; logger.debug("using default user {}", DEFAULT_USER); } dbName = (String) config.get("db"); if (StringUtils.isBlank(dbName)) { dbName = DEFAULT_DB; logger.debug("using default db name {}", DEFAULT_DB); } isProperlyConfigured = true; connect(); if (!checkConnection()) { logger.error("database connection does not work for now, will retry to use the database."); } }</code><technical_language>statically import isBlank() for sake of readability</technical_language>

Target:
public void activate(final BundleContext bundleContext, final Map<String, Object> config) { logger.debug("influxdb persistence service activated"); disconnect(); password = (String) config.get("password"); if (isBlank(password)) { isProperlyConfigured = false; logger .error("influxdb:password", "The password is missing. To specify a password configure the password parameter in openhab.cfg."); return; } url = (String) config.get("url"); if (isBlank(url)) { url = DEFAULT_URL; logger.debug("using default url {}", DEFAULT_URL); } user = (String) config.get("user"); if (isBlank(user)) { user = DEFAULT_USER; logger.debug("using default user {}", DEFAULT_USER); } dbName = (String) config.get("db"); if (isBlank(dbName)) { dbName = DEFAULT_DB; logger.debug("using default db name {}", DEFAULT_DB); } isProperlyConfigured = true; connect(); if (!checkConnection()) { logger.error("database connection does not work for now, will retry to use the database."); } }