auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void main(String[] args) throws IOException { logger.info("REQUEST__SHORT_NOROOT_STRING = " + generateJson(false, false, false)); logger.info("REQUEST__SHORT_NOROOT_OBJECT = " + generateJson(false, false, true)); logger.info("REQUEST__SHORT_ROOT___STRING = " + generateJson(false, true, false)); logger.info("REQUEST__SHORT_ROOT___OBJECT = " + generateJson(false, true, true)); logger.info("REQUEST__FULL__NOROOT_STRING = " + generateJson(true, false, false)); logger.info("REQUEST__FULL__NOROOT_OBJECT = " + generateJson(true, false, true)); logger.info("REQUEST__FULL__ROOT___STRING = " + generateJson(true, true, false)); <START> logger.info("REQUEST__FULL__ROOT___OBJECT = " + generateJson(true, true, true)); <END> }</code><technical_language>I code is generate big JSON test data call tests JSON utilities tested, smart generate once, validate output, dump static golden data. improvement here: this helper class a unit test too, @Test method validates golden data comparing output of generator functions, i.e. similar this main method do assertThat(REQUEST_...).isEqualTo(generate...) for constant. This is important detect bugs inadvertently change output of generator functions, captured existing tests read golden data</technical_language>

Target:
public static void main(String[] args) throws IOException { OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__SHORT_NOROOT_STRING.json", generateJson(false, false, false)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__SHORT_NOROOT_OBJECT.json", generateJson(false, false, true)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__SHORT_ROOT___STRING.json", generateJson(false, true, false)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__SHORT_ROOT___OBJECT.json", generateJson(false, true, true)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__FULL__NOROOT_STRING.json", generateJson(true, false, false)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__FULL__NOROOT_OBJECT.json", generateJson(true, false, true)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__FULL__ROOT___STRING.json", generateJson(true, true, false)); OpenRtbJsonFactoryHelper.writeFile("openrtb-core/src/test/resources/REQUEST__FULL__ROOT___OBJECT.json", generateJson(true, true, true)); }
Source:
<code>public synchronized int write(ByteBuffer src) throws IOException { if (!src.hasArray()) { <START> throw new IllegalArgumentException( <END> "NettyResponseChannel does not work with ByteBuffers that are not backed by " + "byte arrrays"); } return addToResponseBody(src); }</code><technical_language>concatenate in string below</technical_language>

Target:
public synchronized int write(ByteBuffer src) throws IOException { if (!isOpen()) { throw new ClosedChannelException(); } responseMetadataFinalized.set(true); int bytesWritten = src.remaining(); for (int i = 0; i < bytesWritten; i++) { bodyBytes.write(src.get()); } return bytesWritten; }
Source:
<code>private void initCalculations() { <START> try { <END> startDate = (Date) sprint.getAttributes(AtsAttributeTypes.StartDate).getExactlyOne().getValue(); endDate = (Date) sprint.getAttributes(AtsAttributeTypes.EndDate).getExactlyOne().getValue(); } catch (Exception e) { throw new OseeCoreException("Date not available in sprint %s", sprint.getName()); } numActionsCompleted = 0; workCompleted = 0; walkupCompleted = 0; numActionsCompleted = 0; numActionsStarted = 0; numActionsBacklog = 0; }</code><technical_language>sprint.getAttributeValue(AtsAttributeTypes.StartDate). need cast. for EndDate</technical_language>

Target:
private void initCalculations() { try { startDate = adjustDate((Date) sprint.getSoleAttributeValue(AtsAttributeTypes.StartDate), false); endDate = adjustDate((Date) sprint.getSoleAttributeValue(AtsAttributeTypes.EndDate), true); } catch (Exception e) { throw new OseeCoreException("Date not available in sprint %s", sprint.getName()); } numActionsCompleted = 0; workCompleted = 0; walkupCompleted = 0; numActionsCompleted = 0; numActionsStarted = 0; numActionsBacklog = 0; }
Source:
<code>public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.RAISE_STMT, ctx -> { RaiseStatement raiseStatement = (RaiseStatement) ctx.syntaxNode(); if (raiseStatement.expressions().isEmpty()) { return; } Expression raisedExpression = raiseStatement.expressions().get(0); if (!raisedExpression.type().canBeOrExtend(BASE_EXCEPTION)) { ctx.addIssue(raiseStatement, MESSAGE); return; } Symbol symbol = null; if (raisedExpression instanceof HasSymbol) { symbol = ((HasSymbol) raisedExpression).symbol(); <START> } else if (raisedExpression.is(Tree.Kind.CALL_EXPR)) { <END> symbol = ((CallExpression) raisedExpression).calleeSymbol(); } if (!inheritsFromBaseException(symbol)) { ctx.addIssue(raiseStatement, MESSAGE); } }); }</code><technical_language>Removing this line impact unit tests: raise issue anymore on: def raise_builtin_function_python2(): raise super2() # Noncompliant {{Change this code raises object deriving BaseException.}} I get expect issue this test case</technical_language>

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Tree.Kind.RAISE_STMT, ctx -> { RaiseStatement raiseStatement = (RaiseStatement) ctx.syntaxNode(); if (raiseStatement.expressions().isEmpty()) { return; } Expression raisedExpression = raiseStatement.expressions().get(0); if (!raisedExpression.type().canBeOrExtend(BASE_EXCEPTION)) { ctx.addIssue(raiseStatement, MESSAGE); return; } Symbol symbol = null; if (raisedExpression instanceof HasSymbol) { symbol = ((HasSymbol) raisedExpression).symbol(); } else if (raisedExpression.is(Tree.Kind.CALL_EXPR)) { symbol = ((CallExpression) raisedExpression).calleeSymbol(); } if (!mayInheritFromBaseException(symbol)) { ctx.addIssue(raiseStatement, MESSAGE); } }); }
Source:
<code>public HorizontalChildViewHolder(View itemView) { super(itemView); mDataTextView = (TextView) itemView.findViewById(R.id.list_item_horizontal_child_textView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { <START> Log.d(TAG, "Child at " + getAdapterChildPosition() + ", with parent at " + getAdapterParentPosition() + " clicked, child item is \"" + getChildListItem() + "\""); <END> } }); }</code><technical_language>long line</technical_language>

Target:
public HorizontalChildViewHolder(View itemView) { super(itemView); mDataTextView = (TextView) itemView.findViewById(R.id.list_item_horizontal_child_textView); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Log.d(TAG, "Child at " + getChildAdapterPosition() + ", with parent at " + getParentAdapterPosition() + " clicked, child item is \"" + getChildListItem() + "\""); } }); }
Source:
<code>public synchronized void handleRemoval() { final Bridge bridge; final ThingHandler handler; if ((bridge = getBridge()) == null || (handler = bridge.getHandler()) == null) { super.handleRemoval(); return; } final HomematicConfig config = bridge.getConfiguration().as(HomematicConfig.class); final boolean unpairOnDeletion = config.isUnpairOnDeletion() || config.isFactoryResetOnDeletion(); <START> final boolean factoryResetOnDeletion = config.isFactoryResetOnDeletion(); <END> if (unpairOnDeletion) { deviceDeletionPending = true; ((HomematicBridgeHandler) handler).deleteFromGateway(UidUtils.getHomematicAddress(thing), factoryResetOnDeletion, false, true); } else { super.handleRemoval(); } }</code><technical_language>fetch config.isFactoryResetOnDeletion() config hold in a variable</technical_language>

Target:
public synchronized void handleRemoval() { final Bridge bridge; final ThingHandler handler; if ((bridge = getBridge()) == null || (handler = bridge.getHandler()) == null) { super.handleRemoval(); return; } final HomematicConfig config = bridge.getConfiguration().as(HomematicConfig.class); final boolean factoryResetOnDeletion = config.isFactoryResetOnDeletion(); final boolean unpairOnDeletion = factoryResetOnDeletion || config.isUnpairOnDeletion(); if (unpairOnDeletion) { deviceDeletionPending = true; ((HomematicBridgeHandler) handler).deleteFromGateway(UidUtils.getHomematicAddress(thing), factoryResetOnDeletion, false, true); } else { super.handleRemoval(); } }
Source:
<code>public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { super.restoreStateFromViewItem(originalViewItem); if (originalViewItem instanceof HostNetworkInterfaceBondedListViewItem) { HostNetworkInterfaceBondedListViewItem original = (HostNetworkInterfaceBondedListViewItem) originalViewItem; <START> setSlavesExpanded(original.getSlavesState()); <END> } }</code><technical_language>Nit-pick: typecast inlined here, avoiding explicit "original" variable declaration, needed here</technical_language>

Target:
public void restoreStateFromViewItem(PatternflyListViewItem<HostInterfaceLineModel> originalViewItem) { super.restoreStateFromViewItem(originalViewItem); if (originalViewItem instanceof HostNetworkInterfaceBondedListViewItem) { setSlavesExpanded(((HostNetworkInterfaceBondedListViewItem) originalViewItem).getSlavesState()); } }
Source:
<code>public void dispose() { if (disposed) { throw new IllegalStateException("Attempt to invoke ApplicationInstance.dispose() on disposed instance."); } try { if (defaultWindow != null) { defaultWindow.doDispose(); defaultWindow.register(null); } synchronized (taskQueueMap) { taskQueueMap.clear(); } } <START> finally { <END> synchronized(disposed) { disposed = true; } } }</code><technical_language>ABSOLUTE SHOW STOPPER</technical_language>

Target:
public void dispose() { if (disposed) { throw new IllegalStateException("Attempt to invoke ApplicationInstance.dispose() on disposed instance."); } try { if (defaultWindow != null) { defaultWindow.doDispose(); defaultWindow.register(null); } synchronized (taskQueueMap) { taskQueueMap.clear(); } } finally { disposed = true; } }
Source:
<code>public final void throwsExceptionOnActinOnUnproperMethod() throws IOException { <START> final String proper = RandomStringUtils.random(10); <END> String unproper; do { unproper = RandomStringUtils.random(10); } while (unproper.equals(proper)); new TkMethods( Mockito.mock(Take.class), proper ).act( new RqFake(unproper) ); }</code><technical_language>@cyberone revise this test random string? I need for here</technical_language>

Target:
public void throwsExceptionOnActinOnUnproperMethod() throws IOException { new TkMethods(Mockito.mock(Take.class), "PROPER").act( new RqFake("UNPROPER") ); }
Source:
<code>void stopPresenting() { <START> if (observable != null) { <END> observable.detachObservers(); } if (humanTpService != null) { humanTpService.disconnect(); } }</code><technical_language>this DeveloperError ? stopPresenting calling startPresenting</technical_language>

Target:
void stopPresenting() { unsubscribe(observable); humanTpService.disconnect(); }
Source:
<code>public TableManager(Config config) { new JavaTableConfig(config).getTableIds().forEach(tableId -> { addTable(tableId, config); <START> logger.info("Added table " + tableId); <END> }); }</code><technical_language>Minor: logger.debug</technical_language>

Target:
public TableManager(Config config) { new JavaTableConfig(config).getTableIds().forEach(tableId -> { addTable(tableId, config); logger.debug("Added table " + tableId); }); logger.info(String.format("Added %d tables", tableContexts.size())); }
Source:
<code>public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (unsafeParamNames.isEmpty() || !SAFE_ARG_OF.matches(tree, state)) { return Description.NO_MATCH; } List<? extends ExpressionTree> args = tree.getArguments(); ExpressionTree argNameExpression = args.get(0); if (compileTimeConstExpressionMatcher.matches(argNameExpression, state)) { String argName = (String) ((JCTree.JCLiteral) argNameExpression).getValue(); if (unsafeParamNames.stream().anyMatch(unsafeArgName -> unsafeArgName.equalsIgnoreCase(argName))) { return buildDescription(tree) .setMessage("Arguments with name '" + argName + "' must be marked as unsafe.") .addFix(SuggestedFix.builder() <START> .replace(tree.getMethodSelect(), "UnsafeArg.of") <END> .addImport("com.palantir.logsafe.UnsafeArg") .build()) .build(); } } return Description.NO_MATCH; }</code><technical_language>SuggestedFixes.qualifyType "com.palantir.logsafe.UnsafeArg" add import automagically, fully qualify type if a foo.bar.UnsafeArg imported. append ".of" result</technical_language>

Target:
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) { if (unsafeParamNames.isEmpty() || !SAFE_ARG_OF.matches(tree, state)) { return Description.NO_MATCH; } List<? extends ExpressionTree> args = tree.getArguments(); ExpressionTree argNameExpression = args.get(0); if (compileTimeConstExpressionMatcher.matches(argNameExpression, state)) { String argName = (String) ((JCTree.JCLiteral) argNameExpression).getValue(); if (unsafeParamNames.stream().anyMatch(unsafeArgName -> unsafeArgName.equalsIgnoreCase(argName))) { SuggestedFix.Builder builder = SuggestedFix.builder(); String unsafeArg = SuggestedFixes.qualifyType(state, builder, "com.palantir.logsafe.UnsafeArg"); return buildDescription(tree) .setMessage("Arguments with name '" + argName + "' must be marked as unsafe.") .addFix(builder.replace(tree.getMethodSelect(), unsafeArg + ".of") .build()) .build(); } } return Description.NO_MATCH; }
Source:
<code>@Override public void printLastErrors() { <START> kernal.context().exceptionRegistry().printErrors(log); <END> }</code><technical_language>Lets create printLastErrors in kerrnal osUser methods. Log needed</technical_language>

Target:
@Override public void printLastErrors() { kernal.printLastErrors(); }
Source:
<code>public Set<EClass> getSubTypesTopIntersection(EClass eCls1, EClass eCls2) { final Set<EClass> result = new LinkedHashSet<EClass>(); final Set<EClass> subTypes1 = queryEnvironment.getEPackageProvider().getAllSubTypes(eCls1); final Set<EClass> subTypes2 = queryEnvironment.getEPackageProvider().getAllSubTypes(eCls2); <START> final Set<EClass> intersection = new LinkedHashSet<EClass>(); <END> for (EClass subType1 : subTypes1) { if (subTypes2.contains(subType1)) { intersection.add(subType1); } } for (EClass eCls : intersection) { boolean isTopEClass = true; for (EClass superECls : eCls.getEAllSuperTypes()) { if (intersection.contains(superECls)) { isTopEClass = false; break; } } if (isTopEClass) { result.add(eCls); } } return result; }</code><technical_language>Sets.intersection(subTypes1, subTypes2)</technical_language>

Target:
public Set<EClass> getSubTypesTopIntersection(EClass eCls1, EClass eCls2) { final Set<EClass> result = new LinkedHashSet<EClass>(); final Set<EClass> subTypes1 = queryEnvironment.getEPackageProvider().getAllSubTypes(eCls1); final Set<EClass> subTypes2 = queryEnvironment.getEPackageProvider().getAllSubTypes(eCls2); final Set<EClass> intersection = Sets.intersection(subTypes1, subTypes2); for (EClass eCls : intersection) { final boolean isTopEClass = Collections.disjoint(eCls.getEAllSuperTypes(), intersection); if (isTopEClass) { result.add(eCls); } } return result; }
Source:
<code>public boolean isPemFilePresent() { <START> if (pemFile.isPresent()) { <END> Path path = pemFile.get(); if (Files.isRegularFile(path) && Files.isReadable(path)) { return true; } } return false; }</code><technical_language>I this is in right direction, checks happening setPemFile(Path path). idea is want ExportConfiguration instance hold invalid value. set a ExportConfiguration.pemFile if a path a file a valid PrivateKey</technical_language>

Target:
public boolean isPemFilePresent() { return pemFile.isPresent(); }
Source:
<code>void removeConsumer(EventConsumer consumer) { for (RegisteredConsumer cons : consumers) { if (cons.getConsumer().equals(consumer)) { <START> this.consumers.remove(cons); <END> return; } } }</code><technical_language>allow pass (java.util.function.)Consumer (or this notify event), avoid unnecessary collection/garbage</technical_language>

Target:
void removeConsumer(EventConsumer consumer) { consumers.removeIf( registeredConsumer -> registeredConsumer.getConsumer().equals(consumer)); }
Source:
<code><START> public ResponseEntity checkFileFormat(MultipartFile file,String fileHeaderMappring) { <END> ResponseEntity response = null; RestReponseDTO responseDTO = new RestReponseDTO(); String finalMsg = null; if (file != null && file.getSize() > 0) { String fileNm = file.getOriginalFilename(); if (fileNm != null && fileNm.endsWith(".csv")) { String line; BufferedReader reader; InputStream is; try { is = file.getInputStream(); reader = new BufferedReader(new InputStreamReader(is)); CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader(fileHeaderMappring).withFirstRecordAsHeader().withTrim(); CSVParser csvParser = new CSVParser(reader, csvFileFormat); csvParser.parse(reader, csvFileFormat); } catch (Exception e) { finalMsg = ErrorConstants.ERR_NOT_CSV_FILE + ":The file format is not supported, please use correct CSV file, like *.csv "; responseDTO.setMessage(finalMsg); response = new ResponseEntity(responseDTO, org.springframework.http.HttpStatus.BAD_REQUEST); } } else { finalMsg = ErrorConstants.ERR_NOT_CSV_FILE + ":The file format is not supported, please use correct CSV file, like *.csv "; responseDTO.setMessage(finalMsg); response = new ResponseEntity(responseDTO, org.springframework.http.HttpStatus.BAD_REQUEST); } } else { finalMsg = ErrorConstants.ERR_BLANK_FILE + ":The file null or blank"; responseDTO.setMessage(finalMsg); response = new ResponseEntity(responseDTO, org.springframework.http.HttpStatus.BAD_REQUEST); } return response; }</code><technical_language>return error message Exception a simple return instead of returning a ResponseEntity. ResponseEntity constructed in controller</technical_language>

Target:
public void checkFileFormat(MultipartFile file, String fileHeaderMappring) { ResponseEntity response = null; RestReponseDTO responseDTO = new RestReponseDTO(); String finalMsg = null; if (file != null && file.getSize() > 0) { String fileNm = file.getOriginalFilename(); if (fileNm != null && fileNm.endsWith(".csv")) { String line; BufferedReader reader; InputStream is; try { is = file.getInputStream(); reader = new BufferedReader(new InputStreamReader(is)); CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader(fileHeaderMappring).withFirstRecordAsHeader().withTrim(); CSVParser csvParser = new CSVParser(reader, csvFileFormat); csvParser.parse(reader, csvFileFormat); } catch (Exception e) { throw new OpenClinicaSystemException(ErrorConstants.ERR_NOT_CSV_FILE); } } else { throw new OpenClinicaSystemException(ErrorConstants.ERR_NOT_CSV_FILE); } } else { throw new OpenClinicaSystemException(ErrorConstants.ERR_BLANK_FILE); } }
Source:
<code>private void applyUpdate() throws IOException, ErrnoException { Slog.i(TAG, "Applying SELinux policy"); File backup = new File(updateDir.getParentFile(), "backup"); File current = new File(updateDir.getParentFile(), "current"); File tmp = new File(updateDir.getParentFile(), "tmp"); if (current.exists()) { deleteRecursive(backup); Os.rename(current.getPath(), backup.getPath()); } <START> Os.rename(tmp.getPath(), <END> current.getPath()); SystemProperties.set("selinux.reload_policy", "1"); }</code><technical_language>If this fails, try move backup current (provided rename passed)</technical_language>

Target:
private void applyUpdate() throws IOException, ErrnoException { Slog.i(TAG, "Applying SELinux policy"); File backup = new File(updateDir.getParentFile(), "backup"); File current = new File(updateDir.getParentFile(), "current"); File tmp = new File(updateDir.getParentFile(), "tmp"); if (current.exists()) { deleteRecursive(backup); Os.rename(current.getPath(), backup.getPath()); } try { Os.rename(tmp.getPath(), current.getPath()); SystemProperties.set("selinux.reload_policy", "1"); } catch (ErrnoException e) { Slog.e(TAG, "Could not update selinux policy: ", e); if (backup.exists()) { Os.rename(backup.getPath(), current.getPath()); } } }
Source:
<code><START> public void setConnectionId(String connectionId) { <END> setAsString(AtomXPath.id, connectionId); }</code><technical_language>Deprecate setConnectionId instead of setAsString call super.setId method avoid duplication</technical_language>

Target:
public void setConnectionId(String connectionId) { super.setId(connectionId); }
Source:
<code>ServiceBusSessionReceiverClient(ServiceBusSessionReceiverAsyncClient asyncClient, Duration operationTimeout) { this.sessionAsyncClient = Objects.requireNonNull(asyncClient, "'asyncClient' cannot be null."); <START> this.operationTimeout = Objects.requireNonNull(operationTimeout, "'operationTimeout' cannot be null."); <END> }</code><technical_language>do need operationTimeout ctor arg. include this in accept*Session APIs</technical_language>

Target:
ServiceBusSessionReceiverClient(ServiceBusSessionReceiverAsyncClient asyncClient, Duration operationTimeout) { this.sessionAsyncClient = Objects.requireNonNull(asyncClient, "'asyncClient' cannot be null."); this.operationTimeout = operationTimeout; }
Source:
<code>protected void configure(Host hc, Session session) { SshUriProperties sshProperties = sshKeysByHostname.get(hc.getHostName()); String hostKeyAlgorithm = sshProperties.getHostKeyAlgorithm(); if (hostKeyAlgorithm != null) { <START> session.setConfig("server_host_key", hostKeyAlgorithm); <END> } if (sshProperties.getHostKey() == null || !sshProperties.isStrictHostKeyChecking()) { session.setConfig("StrictHostKeyChecking", "no"); } else { session.setConfig("StrictHostKeyChecking", "yes"); } }</code><technical_language>strings public static final vars</technical_language>

Target:
protected void configure(Host hc, Session session) { SshUri sshProperties = sshKeysByHostname.get(hc.getHostName()); String hostKeyAlgorithm = sshProperties.getHostKeyAlgorithm(); if (hostKeyAlgorithm != null) { session.setConfig(SERVER_HOST_KEY, hostKeyAlgorithm); } if (sshProperties.getHostKey() == null || !sshProperties.isStrictHostKeyChecking()) { session.setConfig(STRICT_HOST_KEY_CHECKING, NO_OPTION); } else { session.setConfig(STRICT_HOST_KEY_CHECKING, YES_OPTION); } }
Source:
<code>public void textWithSingleQuote() throws Exception { FreeStyleProject upstream = r.createFreeStyleProject("upstream"); r.createFreeStyleProject("d0wnstr3'am"); upstream.getPublishersList().add(new BuildTrigger("d0wnstr3'am", Result.SUCCESS)); FreeStyleBuild b = r.buildAndAssertSuccess(upstream); <START> r.waitUntilNoActivity(); <END> HtmlPage rsp = r.createWebClient().goTo(b.getUrl()+"console"); System.out.println("Before:\n"+rsp.getWebResponse().getContentAsString()+"\n\n"); try { assertThat(String.valueOf(rsp.getAnchorByText("d0wnstr3'am").click().getWebResponse().getStatusCode()), containsString("200")); } catch(Exception enfe) { String str = "str->\n"; str += rsp.getWebResponse().getContentAsString()+"\n\n"; for(HtmlAnchor ha: rsp.getAnchors()) { str += "getNameAttribute: " + ha.getNameAttribute() + " getTextContent: " + ha.getTextContent() + "\n"; } throw new Exception(str); } }</code><technical_language>Please consistent indentation adding new code. changing indentation this single method pull request more difficult read. integrated development environments (Netbeans, IntelliJ, Visual Studio Code) provide automatic formatting applied subsections (like this new block of code). suggestion r.waitUntilNoActivity();</technical_language>

Target:
public void textWithSingleQuote() throws Exception { FreeStyleProject upstream = r.createFreeStyleProject("upstream"); r.createFreeStyleProject("d0wnstr3'am"); upstream.getPublishersList().add(new BuildTrigger("d0wnstr3'am", Result.SUCCESS)); FreeStyleBuild b = r.buildAndAssertSuccess(upstream); r.waitUntilNoActivity(); HtmlPage rsp = r.createWebClient().goTo(b.getUrl()+"console"); assertThat(String.valueOf(rsp.getAnchorByText("d0wnstr3'am").click().getWebResponse().getStatusCode()), containsString("200")); }
Source:
<code>public void queue( TileCanvasViewGroup tileCanvasViewGroup, Set<Tile> renderSet ) { mTileCanvasViewGroupWeakReference = new WeakReference<>( tileCanvasViewGroup ); mHandler.setTileCanvasViewGroup( tileCanvasViewGroup ); tileCanvasViewGroup.onRenderTaskPreExecute(); for( Runnable runnable : getQueue() ) { if( runnable instanceof TileRenderRunnable ) { TileRenderRunnable tileRenderRunnable = (TileRenderRunnable) runnable; if( tileRenderRunnable.isDone() || tileRenderRunnable.isCancelled() ) { continue; } Tile tile = tileRenderRunnable.getTile(); if( tile != null && !renderSet.contains( tile ) ) { tile.reset(); } } } for( Tile tile : renderSet ) { if( isShutdownOrTerminating() ) { return; } <START> tile.execute( this, tileCanvasViewGroup.getBitmapCleanup()); <END> } }</code><technical_language>whitespace tile.execute( this, tileCanvasViewGroup.getBitmapCleanup() );</technical_language>

Target:
public void queue( TileCanvasViewGroup tileCanvasViewGroup, Set<Tile> renderSet ) { mTileCanvasViewGroupWeakReference = new WeakReference<>( tileCanvasViewGroup ); mHandler.setTileCanvasViewGroup( tileCanvasViewGroup ); tileCanvasViewGroup.onRenderTaskPreExecute(); for( Runnable runnable : getQueue() ) { if( runnable instanceof TileRenderRunnable ) { TileRenderRunnable tileRenderRunnable = (TileRenderRunnable) runnable; if( tileRenderRunnable.isDone() || tileRenderRunnable.isCancelled() ) { continue; } Tile tile = tileRenderRunnable.getTile(); if( tile != null && !renderSet.contains( tile ) ) { tile.reset(); } } } for( Tile tile : renderSet ) { if( isShutdownOrTerminating() ) { return; } tile.execute( this, tileCanvasViewGroup.getBitmapRecycler() ); } }
Source:
<code>public void testRouterClosedDuringOperation() throws Exception { testWithErrorCodes(Collections.singletonMap(ServerErrorCode.No_Error, 9), serverLayout, RouterErrorCode.RouterClosed, new ErrorCodeChecker() { @Override public void check(RouterErrorCode expectedError) throws Exception { future = router.deleteBlob(blobIdString, new ClientCallback()); <START> router.close(); <END> checkErrorCode(future, expectedError); } }); }</code><technical_language>operation complete router is closed</technical_language>

Target:
public void testRouterClosedDuringOperation() throws Exception { testWithErrorCodes(Collections.singletonMap(ServerErrorCode.No_Error, 9), serverLayout, RouterErrorCode.RouterClosed, new ErrorCodeChecker() { @Override public void testAndAssert(RouterErrorCode expectedError) throws Exception { future = router.deleteBlob(blobIdString); router.close(); assertFailureAndCheckErrorCode(future, expectedError); } }); }
Source:
<code>public static IProject[] getValidOpenProjects(Repository repository) throws CoreException { final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); List<IProject> result = new ArrayList<IProject>(); final Path repositoryPath = new Path( repository.getWorkTree().getAbsolutePath()); for (IProject p : projects) { IPath projectLocation = p.getLocation(); if (!p.isOpen() || projectLocation == null) continue; IPath projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME); if (projectFilePath.toFile().exists()) { if <START> (repositoryPath.isPrefixOf(projectLocation)) { <END> result.add(p); } } } return result.toArray(new IProject[result.size()]); }</code><technical_language>this condition, negated, added if above: if(!p.isOpen || projectLocation == null || !repositoryPath.isPrefixOf(projectLocation)) this saves more expensive IO check for file.exists()</technical_language>

Target:
public static IProject[] getValidOpenProjects(Repository repository) throws CoreException { final IProject[] projects = ResourcesPlugin.getWorkspace().getRoot() .getProjects(); List<IProject> result = new ArrayList<IProject>(); final Path repositoryPath = new Path( repository.getWorkTree().getAbsolutePath()); for (IProject p : projects) { IPath projectLocation = p.getLocation(); if (!p.isOpen() || projectLocation == null || repositoryPath.isPrefixOf(projectLocation)) continue; IPath projectFilePath = projectLocation .append(IProjectDescription.DESCRIPTION_FILE_NAME); if (projectFilePath.toFile().exists()) { result.add(p); } } return result.toArray(new IProject[result.size()]); }
Source:
<code>private AsyncHttpClient createHttpClient() { final AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); try { builder.setMaxConnectionsPerHost(-1); builder.setSSLContext(SslUtils.getInstance().getSSLContext(false)); } catch (GeneralSecurityException e) { e.printStackTrace(); <START> } finally { <END> return new AsyncHttpClient(builder.build()); } }</code><technical_language>a client setup issue, a server-side issue. I re-throw GeneralSecurityException (it changes open API ambiguous)</technical_language>

Target:
private AsyncHttpClient createHttpClient() throws KeyManagementException, NoSuchAlgorithmException { final AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); builder.setMaxConnectionsPerHost(-1); builder.setSSLContext(SslUtils.getInstance().getSSLContext()); return new AsyncHttpClient(builder.build()); }
Source:
<code>public void canSaveAndRetrieveDataStoredInRedis() { UserClient client = testUser.getSession().getUserClient(); UserProfile profile = client.getProfile(); profile.setFirstName("☃"); profile.setLastName("지구상의 ３대 극지라 불리는"); client.saveProfile(profile); <START> <END> testUser.getSession().signOut(); Session session = ClientProvider.signIn(new SignInCredentials(testUser.getEmail(), testUser.getPassword())); profile = session.getUserClient().getProfile(); assertEquals("☃", profile.getFirstName()); assertEquals("지구상의 ３대 극지라 불리는", profile.getLastName()); }</code><technical_language>I wanted verify UTF-8 is working end-to-end, do this test other entity, a survey a study</technical_language>

Target:
public void canSaveAndRetrieveDataStoredInRedis() { TestUser testUser = TestUserHelper.createAndSignInUser(UTF8Test.class, true); try { UserClient client = testUser.getSession().getUserClient(); UserProfile profile = client.getProfile(); profile.setFirstName("☃"); profile.setLastName("지구상의 ３대 극지라 불리는"); client.saveProfile(profile); testUser.getSession().signOut(); Session session = ClientProvider.signIn(new SignInCredentials(testUser.getEmail(), testUser.getPassword())); profile = session.getUserClient().getProfile(); assertEquals("☃", profile.getFirstName()); assertEquals("지구상의 ３대 극지라 불리는", profile.getLastName()); } finally { testUser.signOutAndDeleteUser(); } }
Source:
<code>public int getTop(final ViewGroup ancestor, View view){ if <START> (view==ancestor){ <END> return 0; } else { int top = view.getTop(); if (ViewGroup.class.isAssignableFrom(view.getParent().getClass())){ top += getTop(ancestor, (ViewGroup) view.getParent()); } else { Log.i("DataInteraction","giving up calculating the top"); } return top; } }</code><technical_language>spaces</technical_language>

Target:
public int getTop(final ViewGroup ancestor, View view){ if (view == ancestor){ return 0; } else { int top = view.getTop(); if (ViewGroup.class.isAssignableFrom(view.getParent().getClass())){ top += getTop(ancestor, (ViewGroup) view.getParent()); } else { Log.i(TAG, "giving up calculating the top"); } return top; } }
Source:
<code>public QueryableDruidServer pick() { synchronized (this) { <START> TreeMap<Integer, Set<QueryableDruidServer>> prioritzedServers = Maps.newTreeMap(); <END> for (QueryableDruidServer server : servers) { Set<QueryableDruidServer> theServers = prioritzedServers.get(server.getServer().getPriority()); if (theServers == null) { theServers = Sets.newHashSet(); prioritzedServers.put(server.getServer().getPriority(), theServers); } theServers.add(server); } final Set<QueryableDruidServer> highestPriorityServers = prioritzedServers.pollLastEntry().getValue(); final int size = highestPriorityServers.size(); switch (size) { case 0: return null; case 1: return highestPriorityServers.iterator().next(); default: return strategy.pick(highestPriorityServers); } } }</code><technical_language>a bit simple maintain this map instead of a normal hashmap in this class</technical_language>

Target:
public QueryableDruidServer pick() { synchronized (this) { TreeMap<Integer, Set<QueryableDruidServer>> prioritizedServers = Maps.newTreeMap(); for (QueryableDruidServer server : servers) { Set<QueryableDruidServer> theServers = prioritizedServers.get(server.getServer().getPriority()); if (theServers == null) { theServers = Sets.newHashSet(); prioritizedServers.put(server.getServer().getPriority(), theServers); } theServers.add(server); } return strategy.pick(prioritizedServers, segment); } }
Source:
<code>public void selectsMultipleOnSingleSelectTree() throws Exception { try { tree.select(1, 2, 3); fail("Expecting an exception"); } catch (Exception e) { assertEquals("Tree does not support SWT.MULTI, cannot make multiple selections.", e.getMessage()); <START> } <END> }</code><technical_language>another try a multiple String[]</technical_language>

Target:
public void selectsMultipleOnSingleSelectTree() throws Exception { try { tree.select(1, 2, 3); fail("Expecting an exception"); } catch (Exception e) { assertEquals("Tree does not support SWT.MULTI, cannot make multiple selections.", e.getMessage()); } try { tree.select("Node 2", "Node 4"); fail("Expecting an exception"); } catch (Exception e) { assertEquals("Tree does not support SWT.MULTI, cannot make multiple selections.", e.getMessage()); } }
Source:
<code>public AuthenticationConfiguration useMaskedPassword(MaskedPassword password) throws NoSuchAlgorithmException, InvalidKeySpecException { <START> final PasswordFactory passwordFactory = PasswordFactory.getInstance(password.getAlgorithm()); <END> final ClearPasswordSpec spec = passwordFactory.getKeySpec(password, ClearPasswordSpec.class); final char[] clearPassword = spec.getEncodedPassword(); PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); Password finalPassword = factory.generatePassword(new ClearPasswordSpec(clearPassword)).castAs(ClearPassword.class); final CredentialSource filtered = getCredentialSource().without(PasswordCredential.class); return finalPassword == null ? useCredentials(filtered) : useCredentials(filtered).useCredential(new PasswordCredential(finalPassword)); }</code><technical_language>good assert password is null beginning</technical_language>

Target:
public AuthenticationConfiguration useMaskedPassword(MaskedPassword password) throws NoSuchAlgorithmException, InvalidKeySpecException { Assert.assertNotNull(password); final PasswordFactory passwordFactory = PasswordFactory.getInstance(password.getAlgorithm()); final ClearPasswordSpec spec = passwordFactory.getKeySpec(password, ClearPasswordSpec.class); final char[] clearPassword = spec.getEncodedPassword(); PasswordFactory factory = PasswordFactory.getInstance(ClearPassword.ALGORITHM_CLEAR); Password finalPassword = factory.generatePassword(new ClearPasswordSpec(clearPassword)).castAs(ClearPassword.class); final CredentialSource filtered = getCredentialSource().without(PasswordCredential.class); return finalPassword == null ? useCredentials(filtered) : useCredentials(filtered).useCredential(new PasswordCredential(finalPassword)); }
Source:
<code>public void poll() { if (vdsManager.isMonitoringNeeded()) { VmsListFetcher fetcher = getVmsFetcher(); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { processDevices(fetcher); <START> getVmsMonitoring(fetcher, fetchTime).perform(); <END> } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }</code><technical_language>I do other - process status devices 1. status is more important 2. if is external VM triggered FullList - add devices reduce number of calls VDSM</technical_language>

Target:
public void poll() { if (vdsManager.isMonitoringNeeded()) { VmsListFetcher fetcher = getVmsFetcher(); long fetchTime = System.nanoTime(); if (fetcher.fetch()) { getVmsMonitoring(fetcher, fetchTime).perform(); processDevices(fetcher.getVdsmVms().stream().map(VmInternalData::getVmDynamic), fetchTime); } else { log.info("Failed to fetch vms info for host '{}' - skipping VMs monitoring.", vdsManager.getVdsName()); } } }
Source:
<code>private void proxy(Request request, Writer writer, HttpServletResponse response) throws IOException { if (!enabled) { writer.write(""); return; } try { final String data = executor.execute(request).handleResponse(res -> { final StatusLine status = res.getStatusLine(); HttpEntity entity = res.getEntity(); if (entity == null) { throw new ClientProtocolException("Response contains no content"); } response.setStatus(status.getStatusCode()); <START> final InputStreamReader reader = new InputStreamReader(entity.getContent()); <END> return CharStreams.toString(reader); }); response.setContentType("application/json"); writer.write(data); } catch (IOException e) { log.warn("I/O error while calling KairosDB: {}", e.getMessage()); response.sendError(HttpServletResponse.SC_BAD_GATEWAY); } }</code><technical_language>Correct if wrong, setting original body status code, headers lost. is a desired behaviour? do think, reasonable ProxyExchange [<LINK_0>](docs)? However, I worked it, worth it</technical_language>

Target:
private void proxy(Request request, Writer writer, HttpServletResponse response) throws IOException { if (!enabled) { writer.write(""); return; } try { final String data = executor.execute(request).handleResponse(res -> { final StatusLine status = res.getStatusLine(); HttpEntity entity = res.getEntity(); if (entity == null) { throw new ClientProtocolException("Response contains no content"); } response.setStatus(status.getStatusCode()); Arrays.stream(res.getAllHeaders()).forEach(h -> response.setHeader(h.getName(), h.getValue())); final InputStreamReader reader = new InputStreamReader(entity.getContent()); return CharStreams.toString(reader); }); response.setContentType("application/json"); writer.write(data); } catch (IOException e) { log.warn("I/O error while calling KairosDB: {}", e.getMessage()); response.sendError(HttpServletResponse.SC_BAD_GATEWAY); } }
Source:
<code>private String getMethodName(MethodInvocationTree mit) { <START> if (mit.methodSelect().is(Tree.Kind.MEMBER_SELECT)) { <END> return ((MemberSelectExpressionTree) mit.methodSelect()).identifier().name(); } return ((IdentifierTree) mit.methodSelect()).name(); }</code><technical_language>a variable for mit.methodSelect() instead of calling 3 times</technical_language>

Target:
private String getMethodName(MethodInvocationTree mit) { ExpressionTree methodSelect = mit.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { return ((MemberSelectExpressionTree) methodSelect).identifier().name(); } return ((IdentifierTree) methodSelect).name(); }
Source:
<code>public KafkaTransportProvider(DatastreamTask datastreamTask, List<KafkaProducerWrapper<byte[], byte[]>> producers, Properties props, String metricsNamesPrefix) { org.apache.commons.lang.Validate.notNull(datastreamTask, "null tasks"); org.apache.commons.lang.Validate.notNull(producers, "null producer wrappers"); _producers = producers; _datastreamTask = datastreamTask; LOG.info("Creating kafka transport provider with properties: {}", props); if (!props.containsKey(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG)) { String errorMessage = "Bootstrap servers are not set"; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } <START> _preserveSourceEventTimestamp = Boolean.TRUE.toString().equals(datastreamTask.getDatastreams().get(0).getMetadata() .getOrDefault(DatastreamMetadataConstants.PRESERVE_EVENT_SOURCE_TIMESTAMP, Boolean.FALSE.toString())); <END> _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _metricsNamesPrefix = metricsNamesPrefix == null ? CLASS_NAME : metricsNamesPrefix + CLASS_NAME; _eventWriteRate = new Meter(); _eventByteWriteRate = new Meter(); _eventTransportErrorRate = new Meter(); }</code><technical_language>This condensed: _preserveSourceEventTimestamp = Boolean.parseBoolean(datastreamTask.getDatastreams().get(0).getMetadata().get(DatastreamMetadataConstants. PRESERVE_EVENT_SOURCE_TIMESTAMP));</technical_language>

Target:
public KafkaTransportProvider(DatastreamTask datastreamTask, List<KafkaProducerWrapper<byte[], byte[]>> producers, Properties props, String metricsNamesPrefix) { org.apache.commons.lang.Validate.notNull(datastreamTask, "null tasks"); org.apache.commons.lang.Validate.notNull(producers, "null producer wrappers"); _producers = producers; _datastreamTask = datastreamTask; LOG.info("Creating kafka transport provider with properties: {}", props); if (!props.containsKey(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG)) { String errorMessage = "Bootstrap servers are not set"; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } _preserveEventSourceTimestamp = Boolean.parseBoolean(datastreamTask.getDatastreams().get(0).getMetadata() .getOrDefault(DatastreamMetadataConstants.PRESERVE_EVENT_SOURCE_TIMESTAMP, Boolean.FALSE.toString())); _dynamicMetricsManager = DynamicMetricsManager.getInstance(); _metricsNamesPrefix = metricsNamesPrefix == null ? CLASS_NAME : metricsNamesPrefix + CLASS_NAME; _eventWriteRate = new Meter(); _eventByteWriteRate = new Meter(); _eventTransportErrorRate = new Meter(); }
Source:
<code><START> private static synchronized RealmCache getCache(String realmPath, boolean createIfNotExist) { <END> RealmCache cacheToReturn = null; Iterator<Map.Entry<String, WeakReference<RealmCache>>> it = cachesMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, WeakReference<RealmCache>> entry = it.next(); RealmCache cache = entry.getValue().get(); if (cache == null) { it.remove(); } else if (entry.getKey().equals(realmPath)) { cacheToReturn = cache; } } if (cacheToReturn == null && createIfNotExist) { cacheToReturn = new RealmCache(); cachesMap.put(realmPath, new WeakReference<RealmCache>(cacheToReturn)); } return cacheToReturn; }</code><technical_language>is this synchronized? is is a concern multi-threaded access cacheMap. If is case, *must* synchronize other access cacheMap lock... I suggest consider a lock other Class object</technical_language>

Target:
private static RealmCache getCache(String realmPath, boolean createIfNotExist) { RealmCache cacheToReturn = null; synchronized (cachesList) { Iterator<WeakReference<RealmCache>> it = cachesList.iterator(); while (it.hasNext()) { RealmCache cache = it.next().get(); if (cache == null) { it.remove(); } else if (cache.realmPath.equals(realmPath)) { cacheToReturn = cache; } } if (cacheToReturn == null && createIfNotExist) { cacheToReturn = new RealmCache(realmPath); cachesList.add(new WeakReference<RealmCache>(cacheToReturn)); } } return cacheToReturn; }
Source:
<code>@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); subscriptions.add(timespanSubject .flatMap(trendingSearch) <START> .map(new SearchResultToRepositoryList()), END> trendingAdapter); timespanSubject.onNext(timespanAdapter.getItem(timespanView.getSelectedItemPosition())); }</code><technical_language>Is this guy stateless? a static instance() method it</technical_language>

Target:
@Override protected void onAttachedToWindow() { super.onAttachedToWindow(); subscriptions.add(timespanSubject .flatMap(trendingSearch) .map(SearchResultToRepositoryList.instance()), trendingAdapter); timespanSubject.onNext(timespanAdapter.getItem(timespanView.getSelectedItemPosition())); }
Source:
<code>public BookPage[] getAllPages() { List<BookPage> pages = new ArrayList<>(); <START> pages.addAll((Collection<BookPage>) Arrays.stream(getEntries()).flatMap(entry -> Arrays.stream(entry.getPages())).collect(Collectors.toList())); <END> for (BookCategory subcategory : getSubcategories()) { pages.addAll(Arrays.asList(subcategory.getAllPages())); } return pages.toArray(new BookPage[pages.size()]); }</code><technical_language>totes put this in line \o/</technical_language>

Target:
public BookPage[] getAllPages() { List<BookPage> pages = Arrays.stream(getEntries()) .flatMap(entry -> Arrays.stream(entry.getPages())) .collect(Collectors.toList()); for (BookCategory subcategory : getSubcategories()) { pages.addAll(Arrays.asList(subcategory.getAllPages())); } return pages.toArray(new BookPage[pages.size()]); }
Source:
<code><START> private List<String> collectAdminRolesIfAny() throws DotDataException { <END> final List <Role> availableRoles = new ArrayList<>(2); final Role admin = roleAPI.loadRoleByKey(Role.ADMINISTRATOR); if(null != admin){ availableRoles.add(admin); } final Role cmsAdmin = roleAPI.loadCMSAdminRole(); if(null != cmsAdmin){ availableRoles.add(cmsAdmin); } return availableRoles.stream().map(Role::getId).collect(CollectionsUtils.toImmutableList()); }</code><technical_language>I do return Arrays.asList (roleAPI.loadRoleByKey(Role.ADMINISTRATOR), roleAPI.loadCMSAdminRole()) .stream().filter(role -> null != role).map(Role::getId).collect(CollectionsUtils.toImmutableList());</technical_language>

Target:
private List<String> collectAdminRolesIfAny() throws DotDataException { final List <Role> availableRoles = Arrays.asList( roleAPI.loadRoleByKey(Role.ADMINISTRATOR), roleAPI.loadCMSAdminRole() ); return availableRoles.stream().filter(Objects::nonNull).map(Role::getId).collect(CollectionsUtils.toImmutableList()); }
Source:
<code>public boolean delete(TileObject tile) throws StorageException { Utils.updateLogId("DELETE-" + tile.toString()); File file = fileManager.getFile(tile); Utils.debug(LOGGER, "Tile mapped to file '%s'.", file); <START> initDatabaseFileIfNeeded(file, tile.getLayerName(), tile.getBlobFormat()); <END> return connectionManager.doWork(file, false, connection -> { MBTilesFile mbtiles = GeoToolsMbtilesUtils.getMBTilesFile(connection, file); MBTilesTile gtTile = new MBTilesTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); try { byte[] olData = mbtiles.loadTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]).getData(); if (olData != null) { mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) { deleteTileCreateTime(connection, tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); } Utils.debug(LOGGER, "Tile deleted from file '%s'.", file); return true; } } catch (Exception exception) { throw Utils.exception(exception, "Error deleting tile '%s' from MBTiles file '%s'.", tile, file); } Utils.debug(LOGGER, "Tile not found on file '%s'.", file); return false; }); }</code><technical_language>Hmm... if tile is do need init remove a tile it? :-)</technical_language>

Target:
public boolean delete(TileObject tile) throws StorageException { File file = fileManager.getFile(tile); if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' mapped to file '%s'.", tile, file)); } if (!file.exists()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Containing file '%s' for tile '%s' doesn't exists.", file, tile)); } return false; } return connectionManager.doWork(file, false, connection -> { MBTilesFile mbtiles = GeoToolsMbtilesUtils.getMBTilesFile(connection, file); MBTilesTile gtTile = new MBTilesTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); try { byte[] olData = mbtiles.loadTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]).getData(); if (olData != null) { mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) { deleteTileCreateTime(connection, tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' deleted from file '%s'.", tile, file)); } return true; } } catch (Exception exception) { throw Utils.exception(exception, "Error deleting tile '%s' from MBTiles file '%s'.", tile, file); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' not found on file '%s'.", tile, file)); } return false; }); }
Source:
<code>private static JdbcStatementBuilder<RowData> createRowDataJdbcStatementBuilder(JdbcDialect dialect, LogicalType[] types) { <START> return (st, record) -> dialect.getRowConverter(RowType.of(types)).toExternal(record, st); <END> }</code><technical_language>Do call dialect.getRowConverter runtime</technical_language>

Target:
private static JdbcStatementBuilder<RowData> createRowDataJdbcStatementBuilder(JdbcDialect dialect, LogicalType[] types) { final JdbcRowConverter converter = dialect.getRowConverter(RowType.of(types)); return (st, record) -> converter.toExternal(record, st); }