auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void checkFieldPresence() throws IOException { List<Region> regions = new ArrayList<>(); regions.add(new Region("11", 183000, 183300)); List<String> exclude = new ArrayList<>(); List<VariantEntity> variantEntityList = variantEntityRepository <START> .findByRegionsAndComplexFilters(regions, new ArrayList<>(), exclude, <END> new PageRequest(0, 100000000)); for (VariantEntity currVariantEntity : variantEntityList) { assertFalse(currVariantEntity.getSourceEntries().isEmpty()); assertFalse(currVariantEntity.getIds().isEmpty()); for (Map.Entry<String, VariantSourceEntry> sourceEntryEntry : currVariantEntity.getSourceEntries().entrySet()){ assertFalse(sourceEntryEntry.getValue().getAttributes().isEmpty()); } } }</code><technical_language>argument a variable for clarity (same regions exclude)</technical_language>

Target:
public void checkFieldPresence() throws IOException { List<Region> regions = new ArrayList<>(); regions.add(new Region("11", 183000, 183300)); List<VariantEntityRepositoryFilter> filters = new ArrayList<>(); List<String> exclude = new ArrayList<>(); List<VariantEntity> variantEntityList = variantEntityRepository .findByRegionsAndComplexFilters(regions, filters, exclude, new PageRequest(0, 100000000)); for (VariantEntity currVariantEntity : variantEntityList) { assertFalse(currVariantEntity.getSourceEntries().isEmpty()); assertFalse(currVariantEntity.getIds().isEmpty()); for (Map.Entry<String, VariantSourceEntry> sourceEntryEntry : currVariantEntity.getSourceEntries().entrySet()){ assertFalse(sourceEntryEntry.getValue().getAttributes().isEmpty()); } } }
Source:
<code>public void testSelectionAfterCreateLineTool() { DLine dLine = tableClasses.getLines().get(0); final String tool_Name = "Create Class"; final AbstractToolDescription tool = getTool(tool_Name); changeSelectionExpression(tool, "[instance/]", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, <START> null, 1); <END> changeSelectionExpression(tool, "", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 1); changeSelectionExpression(tool, "[/]", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); }</code><technical_language>nesting selected element is "NewEClass4"? 1- adapting check in AbstractToolDescriptionTestCase.checkExpectedElementsInSelection(DialectEditor, List<String>, int): selections.get(i).toString().startsWith(objectNameToCheck) replaced selections.get(i).toString().contains(objectNameToCheck) 2- providind a comparator method in AbstractToolDescriptionTestCase overridden</technical_language>

Target:
public void testSelectionAfterCreateLineTool() { DLine dLine = tableClasses.getLines().get(0); final String tool_Name = "Create Class"; final AbstractToolDescription tool = getTool(tool_Name); changeSelectionExpression(tool, "[instance/]", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, Lists.newArrayList("NewEClass"), 1, true); changeSelectionExpression(tool, "", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, Lists.newArrayList("NewEClass"), 1, true); changeSelectionExpression(tool, "[/]", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); changeSelectionExpression(tool, "service:stdEmptyCollection", false); TestsUtil.synchronizationWithUIThread(); applyCreateLineTool(tool_Name, dLine.getContainer(), dLine.getTarget()); TestsUtil.synchronizationWithUIThread(); checkExpectedElementsInSelection(editor, null, 0); }
Source:
<code>protected DiskImage getImageInfoFromIRS(final DiskImage targetImage) { try { VDSReturnValue ret = runVdsCommand( VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(targetImage.getStoragePoolId(), targetImage.getStorageIds().get(0), targetImage.getId(), targetImage.getImageId())); return (DiskImage) ret.getReturnValue(); } catch (EngineException e) { <START> log.error("Failed to connect to vdsm to get image info", e); <END> return null; } }</code><technical_language>log is incorrect - do "failed connect"</technical_language>

Target:
protected DiskImage getImageInfoFromIRS(final DiskImage targetImage) { try { VDSReturnValue ret = runVdsCommand( VDSCommandType.GetImageInfo, new GetImageInfoVDSCommandParameters(targetImage.getStoragePoolId(), targetImage.getStorageIds().get(0), targetImage.getId(), targetImage.getImageId())); return (DiskImage) ret.getReturnValue(); } catch (EngineException e) { log.error("Failed to get info of volume '{0}' using GetImageInfo", targetImage.getImageId(), e); return null; } }
Source:
<code>public static void toStringSqlArgs(final StringBuilder sb, Object[] args) { if (args instanceof Object[][]) { for (Object[] rowOfArgs : (Object[][]) args) { toStringSqlArgs(sb, rowOfArgs); } } else { sb.append("("); for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg == null) { sb.append("NULL: 'null'"); } else { sb.append(arg.getClass().getName()); sb.append(": '"); if (arg instanceof ByteArrayInputStream) { @SuppressWarnings("resource") ByteArrayInputStream bais = (ByteArrayInputStream) arg; byte[] bytes = new byte[bais.available()]; <START> ByteStreams.readFully(bais, bytes, 0, bais.available()); <END> sb.append(Arrays.toString(bytes)); } else { sb.append(arg.toString()); } sb.append("'"); } if (i != args.length - 1) { sb.append(", "); } } sb.append(")\n"); } }</code><technical_language>This automated refactor throws IOException happen reading ByteArrayInputStream suggestion try { ByteStreams.readFully(bais, bytes, 0, bais.available()); } catch (IOException e) { throw new SafeRuntimeException("Unable read SQL args ByteArrayInputStream", e); }</technical_language>

Target:
public static void toStringSqlArgs(final StringBuilder sb, Object[] args) { if (args instanceof Object[][]) { for (Object[] rowOfArgs : (Object[][]) args) { toStringSqlArgs(sb, rowOfArgs); } } else { sb.append("("); for (int i = 0; i < args.length; i++) { Object arg = args[i]; if (arg == null) { sb.append("NULL: 'null'"); } else { sb.append(arg.getClass().getName()); sb.append(": '"); if (arg instanceof ByteArrayInputStream) { @SuppressWarnings("resource") ByteArrayInputStream bais = (ByteArrayInputStream) arg; byte[] bytes = new byte[bais.available()]; bais.read(bytes, 0, bais.available()); sb.append(Arrays.toString(bytes)); } else { sb.append(arg.toString()); } sb.append("'"); } if (i != args.length - 1) { sb.append(", "); } } sb.append(")\n"); } }
Source:
<code>public void testGet(){ SameDiff sd = SameDiff.create(); INDArray arr = Nd4j.create(10, 10, 10); SDVariable x = sd.var(arr); INDArray expOut1 = arr.get(NDArrayIndex.point(4), NDArrayIndex.point(5)); SDVariable result1 = x.get(SDIndex.point(4), SDIndex.point(5)); <START> assertEquals(expOut1, result1); <END> INDArray expOut2 = arr.get(NDArrayIndex.point(4), NDArrayIndex.all()); SDVariable result2 = x.get(SDIndex.point(4), SDIndex.all()); assertEquals(expOut2, result2); INDArray expOut3 = arr.get(NDArrayIndex.interval(3, 8), NDArrayIndex.point(2)); SDVariable result3 = x.get(SDIndex.interval(3, 8), SDIndex.point(5)); assertEquals(expOut3, result3); INDArray expOut4 = arr.get(NDArrayIndex.point(4), NDArrayIndex.interval(2, 2, 9), NDArrayIndex.all()); SDVariable result4 = x.get(SDIndex.point(4), SDIndex.interval(2, 2, 9), SDIndex.all()); assertEquals(expOut4, result4); }</code><technical_language>assertEquals pass... missing exec() getArr()</technical_language>

Target:
public void testGet(){ SameDiff sd = SameDiff.create(); INDArray arr = Nd4j.create(10, 10); SDVariable x = sd.var(arr); INDArray expOut1 = arr.get(NDArrayIndex.point(4), NDArrayIndex.point(5)); SDVariable result1 = x.get(SDIndex.point(4), SDIndex.point(5)); assertEquals(expOut1, result1.eval()); INDArray expOut2 = arr.get(NDArrayIndex.point(4), NDArrayIndex.all()); SDVariable result2 = x.get(SDIndex.point(4), SDIndex.all()); assertEquals(expOut2, result2.eval()); INDArray expOut3 = arr.get(NDArrayIndex.interval(3, 8)); SDVariable result3 = x.get(SDIndex.interval(3, 8)); System.out.println(ArrayUtils.toString(expOut3.shape())); System.out.println(ArrayUtils.toString(result3.eval().shape())); assertArrayEquals(expOut3.shape(), result3.eval().shape()); assertEquals(expOut3, result3.eval()); }
Source:
<code>public static ArtifactClient getTestInstance(String username, String password) { String host = System.getProperty("strongbox.host") != null ? System.getProperty("strongbox.host") : "localhost"; int port = System.getProperty("strongbox.port") != null ? Integer.parseInt(System.getProperty("strongbox.port")) : 48080; ArtifactClient client = new ArtifactClient(); <START> client.setUsername(username != null ? username : "admin"); <END> client.setPassword(password != null ? password : "password"); client.setPort(port); client.setContextBaseUrl("http://" + host + ":" + client.getPort()); return client; }</code><technical_language>This needs deployer user</technical_language>

Target:
public static ArtifactClient getTestInstance(String username, String password) { String host = System.getProperty("strongbox.host") != null ? System.getProperty("strongbox.host") : "localhost"; int port = System.getProperty("strongbox.port") != null ? Integer.parseInt(System.getProperty("strongbox.port")) : 48080; ArtifactClient client = new ArtifactClient(); client.setUsername(username != null ? username : "deployer"); client.setPassword(password != null ? password : "password"); client.setPort(port); client.setContextBaseUrl("http://" + host + ":" + client.getPort()); return client; }
Source:
<code>public SplitSource getSplits(Session session, TableHandle table, SplitSchedulingStrategy splitSchedulingStrategy) { ConnectorId connectorId = table.getConnectorId(); ConnectorSplitManager splitManager = getConnectorSplitManager(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); ConnectorSplitSource source; if (table.getLayout().isPresent()) { source = splitManager.getSplits( table.getTransaction(), connectorSession, table.getLayout().get(), splitSchedulingStrategy); } else { <START> try { <END> source = splitManager.getSplits(table.getConnectorHandle(), table.getTransaction(), connectorSession, splitSchedulingStrategy); } catch (UnsupportedOperationException e) { source = splitManager.getSplits( table.getTransaction(), connectorSession, metadata.getLayout(session, table, Constraint.alwaysTrue(), Optional.empty()).get().getLayout().getHandle().getConnectorHandle(), splitSchedulingStrategy); } } SplitSource splitSource = new ConnectorAwareSplitSource(connectorId, table.getTransaction(), source); if (minScheduleSplitBatchSize > 1) { splitSource = new BufferingSplitSource(splitSource, minScheduleSplitBatchSize); } return splitSource; }</code><technical_language>This is scary. fail 100% in prod. Throwing exception in Java is expensive</technical_language>

Target:
public SplitSource getSplits(Session session, TableHandle table, SplitSchedulingStrategy splitSchedulingStrategy) { ConnectorId connectorId = table.getConnectorId(); ConnectorSplitManager splitManager = getConnectorSplitManager(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); ConnectorTableLayoutHandle layout; if (!table.getLayout().isPresent()) { TableLayoutResult result = metadata.getLayout(session, table, Constraint.alwaysTrue(), Optional.empty()); layout = result.getLayout().getLayoutHandle(); } else { layout = table.getLayout().get(); } ConnectorSplitSource source = splitManager.getSplits( table.getTransaction(), connectorSession, layout, splitSchedulingStrategy); SplitSource splitSource = new ConnectorAwareSplitSource(connectorId, table.getTransaction(), source); if (minScheduleSplitBatchSize > 1) { splitSource = new BufferingSplitSource(splitSource, minScheduleSplitBatchSize); } return splitSource; }
Source:
<code><START> public ConsoleWarningsPrinter(ConsolePrinter console) <END> { this.console = requireNonNull(console, "console is null"); }</code><technical_language>this need public</technical_language>

Target:
ConsoleWarningsPrinter(ConsolePrinter console) { super(OptionalInt.of(DISPLAYED_WARNINGS)); this.console = requireNonNull(console, "console is null"); }
Source:
<code><START> public void expand() { <END> try { ui.testCase.setImplicitWait(1, TimeUnit.SECONDS); getElement().findElement(By.xpath(" } catch (NoSuchElementException e) { } finally { ui.testCase.setImplicitWait(); } waitForTransition(); }</code><technical_language>do expand() collapse() methods catch NoSuchElementException? In addition waitForTransition() sense if element clicked</technical_language>

Target:
public void expand() throws NoSuchElementException { try { ui.testCase.setImplicitWait(1, TimeUnit.SECONDS); getElement().findElement(By.xpath(" waitForTransition(); } finally { ui.testCase.setImplicitWait(); } }
Source:
<code>public static void show(UIFacade uiFacade) { JLabel label = new JLabel(GanttLanguage.getInstance().formatText("restartApplication")); JPanel panel = new JPanel(); panel.add(label); OkAction okAction = new OkAction() { @Override public void actionPerformed(ActionEvent e) { ScheduledExecutorService schedulerExecutor = Executors.newScheduledThreadPool(2); Callable<Process> callable = () -> { ProcessBuilder builder = new ProcessBuilder( SystemUtils.IS_OS_WINDOWS? "cmd /c start \"\" ganttproject.bat" : "ganttproject"); return builder.start(); }; FutureTask<Process> futureTask = new FutureTask<>(callable); schedulerExecutor.submit(futureTask); System.exit(0); } }; <START> UIFacade.Dialog dlg = uiFacade.createDialog(panel, new Action[]{okAction, CancelAction.EMPTY}, ""); <END> dlg.show(); }</code><technical_language>I UIFacade.showConfirmationDialog showOptionDialog here</technical_language>

Target:
public static void show(UIFacade uiFacade) { OkAction okAction = new OkAction() { @Override public void actionPerformed(ActionEvent e) { uiFacade.getMainFrame().dispatchEvent(new WindowEvent(uiFacade.getMainFrame(), WindowEvent.WINDOW_CLOSING)); } }; uiFacade.showOptionDialog(QUESTION_MESSAGE, GanttLanguage.getInstance().formatText("restartApplication"), new Action[]{okAction, CancelAction.EMPTY}); }
Source:
<code>private void stopCacheSafely(GridCacheContext<?, ?> cctx, boolean clearDbObjects) { sharedCtx.database().checkpointReadLock(); try { prepareCacheStop(cctx.name(), false, clearDbObjects); if (!cctx.group().hasCaches()) <START> stopCacheGroup(cctx.group().groupId(), clearDbObjects); <END> } finally { sharedCtx.database().checkpointReadUnlock(); } }</code><technical_language>clearDbObjects is incorrect destroy == false. IMHO valid for flag is false</technical_language>

Target:
private void stopCacheSafely(GridCacheContext<?, ?> cctx, boolean clearDbObjects) { sharedCtx.database().checkpointReadLock(); try { prepareCacheStop(cctx.name(), false, clearDbObjects); if (!cctx.group().hasCaches()) stopCacheGroup(cctx.group().groupId(), false); } finally { sharedCtx.database().checkpointReadUnlock(); } }
Source:
<code>public boolean validateParam(String expectedType) { clearError(); String value = view.getValue(); if (isEmpty(value)) { setError(translationService.getValue(PARAM_MUST_BE_COMPLETED_ERROR)); return false; } <START> if (Short.class.getName().equals(expectedType)) { <END> try { Short.parseShort(value); } catch (NumberFormatException e) { setError(translationService.getValue(SHORT_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (Integer.class.getName().equals(expectedType)) { try { Integer.parseInt(value); } catch (NumberFormatException e) { setError(translationService.getValue(INTEGER_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (Long.class.getName().equals(expectedType)) { try { Long.parseLong(value); } catch (NumberFormatException e) { setError(translationService.getValue(LONG_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (Float.class.getName().equals(expectedType)) { try { Float.parseFloat(value); } catch (NumberFormatException e) { setError(translationService.getValue(FLOAT_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (Double.class.getName().equals(expectedType)) { try { Double.parseDouble(value); } catch (NumberFormatException e) { setError(translationService.getValue(DOUBLE_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (BigDecimal.class.getName().equals(expectedType)) { try { new BigDecimal(value); } catch (NumberFormatException e) { setError(translationService.getValue(BIG_DECIMAL_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } if (BigInteger.class.getName().equals(expectedType)) { try { new BigInteger(value); } catch (NumberFormatException e) { setError(translationService.getValue(BIG_INTEGER_NUMERIC_VALUE_EXPECTED_ERROR)); return false; } } return true; }</code><technical_language>conditional sentences, blocks (try/catch) same, redudant code. simplified some set of Functions results a bit more functional style readable? Thx!</technical_language>

Target:
public boolean validateParam(String expectedType) { clearError(); String value = view.getValue(); if (isEmpty(value)) { setError(translationService.getValue(PARAM_MUST_BE_COMPLETED_ERROR)); return false; } if (Short.class.getName().equals(expectedType)) { return validateNumber(value, Short::parseShort, SHORT_NUMERIC_VALUE_EXPECTED_ERROR); } if (Integer.class.getName().equals(expectedType)) { return validateNumber(value, Integer::parseInt, INTEGER_NUMERIC_VALUE_EXPECTED_ERROR); } if (Long.class.getName().equals(expectedType)) { return validateNumber(value, Long::parseLong, LONG_NUMERIC_VALUE_EXPECTED_ERROR); } if (Float.class.getName().equals(expectedType)) { return validateNumber(value, Float::parseFloat, FLOAT_NUMERIC_VALUE_EXPECTED_ERROR); } if (Double.class.getName().equals(expectedType)) { return validateNumber(value, Double::parseDouble, DOUBLE_NUMERIC_VALUE_EXPECTED_ERROR); } if (BigDecimal.class.getName().equals(expectedType)) { return validateNumber(value, BigDecimal::new, BIG_DECIMAL_NUMERIC_VALUE_EXPECTED_ERROR); } if (BigInteger.class.getName().equals(expectedType)) { return validateNumber(value, BigInteger::new, BIG_INTEGER_NUMERIC_VALUE_EXPECTED_ERROR); } return true; }
Source:
<code>public void writeFilter(InputStream input, OutputStream output, String charset, HashMap<String, String> otherParams, FilterCallback cb) throws DataFilterException, IOException { output.write(input.read()); <START> return; <END> }</code><technical_language>exact purpose this return here</technical_language>

Target:
public void writeFilter(InputStream input, OutputStream output, String charset, HashMap<String, String> otherParams, FilterCallback cb) throws DataFilterException, IOException { output.write(input.read()); }
Source:
<code>public Object invoke(Object proxy, final Method method, Object[] args) { try { if (method.isAnnotationPresent(ResumeOperation.class)) { throw logger.logExceptionAsError(Exceptions.propagate( new Exception("The resume operation isn't supported."))); } final SwaggerMethodParser methodParser = getMethodParser(method); final HttpRequest request = createHttpRequest(methodParser, args); Context context = methodParser.setContext(args) .addData("caller-method", methodParser.getFullyQualifiedMethodName()) <START> .addData("eagerly-read-response", isReturnTypeDecodable(methodParser.getReturnType())); <END> context = startTracingSpan(method, context); if (request.getBody() != null) { request.setBody(validateLength(request)); } final Mono<HttpResponse> asyncResponse = send(request, context); Mono<HttpDecodedResponse> asyncDecodedResponse = this.decoder.decode(asyncResponse, methodParser); return handleRestReturnType(asyncDecodedResponse, methodParser, methodParser.getReturnType(), context); } catch (IOException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } }</code><technical_language>user control this behavior is this intended for internal only</technical_language>

Target:
public Object invoke(Object proxy, final Method method, Object[] args) { try { if (method.isAnnotationPresent(ResumeOperation.class)) { throw logger.logExceptionAsError(Exceptions.propagate( new Exception("The resume operation isn't supported."))); } final SwaggerMethodParser methodParser = getMethodParser(method); final HttpRequest request = createHttpRequest(methodParser, args); Context context = methodParser.setContext(args) .addData("caller-method", methodParser.getFullyQualifiedMethodName()) .addData(EAGERLY_READ_RESPONSE_CONTEXT_KEY, isReturnTypeDecodable(methodParser.getReturnType())); context = startTracingSpan(method, context); if (request.getBody() != null) { request.setBody(validateLength(request)); } final Mono<HttpResponse> asyncResponse = send(request, context); Mono<HttpDecodedResponse> asyncDecodedResponse = this.decoder.decode(asyncResponse, methodParser); return handleRestReturnType(asyncDecodedResponse, methodParser, methodParser.getReturnType(), context); } catch (IOException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } }
Source:
<code>public void showClassificationConfigurationDialog(Model model) { final DialogClassificationConfiguration dialog = new DialogClassificationConfiguration(shell, model, controller); <START> dialog.open(); <END> }</code><technical_language>Please return dialog.open()</technical_language>

Target:
public boolean showClassificationConfigurationDialog(Model model) { final DialogClassificationConfiguration dialog = new DialogClassificationConfiguration(shell, model.getClassificationModel().getCurrentConfiguration()); dialog.create(); return dialog.open() == Window.OK; }
Source:
<code>long panel_shouldShowFilename (long id, long sel, long arg0, long arg1) { NSString path = new NSString(arg1); if (filterExtensions != null && filterExtensions.length != 0) { NSFileManager manager = NSFileManager.defaultManager(); long ptr = OS.malloc(1); boolean found = manager.fileExistsAtPath(path, ptr); byte[] isDirectory = new byte[1]; OS.memmove(isDirectory, ptr, 1); OS.free(ptr); if (found) { if (isDirectory[0] != 0) { return 1; <START> } else { <END> String fileName = path.lastPathComponent().getString(); if (popup != null) { int filterIndex = (int) popup.indexOfSelectedItem(); String extensions = filterExtensions [filterIndex]; int start = 0, length = extensions.length (); while (start < length) { int index = extensions.indexOf (EXTENSION_SEPARATOR, start); if (index == -1) index = length; String filter = extensions.substring (start, index).trim (); if (filter.equalsIgnoreCase (fileName)) return 1; if (filter.equals ("*") || filter.equals ("*.*")) return 1; if (filter.startsWith ("*.")) filter = filter.substring (2); if ((fileName.toLowerCase ()).endsWith("." + filter.toLowerCase ())) return 1; start = index + 1; } return 0; } } } } return 1; }</code><technical_language>Changing 'else' 'else if ' as: else if (popup != null) { // current else code } more cleaner</technical_language>

Target:
long panel_shouldShowFilename (long id, long sel, long arg0, long arg1) { NSString path = new NSString(arg1); if (filterExtensions != null && filterExtensions.length != 0) { NSFileManager manager = NSFileManager.defaultManager(); long ptr = OS.malloc(1); boolean found = manager.fileExistsAtPath(path, ptr); byte[] isDirectory = new byte[1]; OS.memmove(isDirectory, ptr, 1); OS.free(ptr); if (found) { if (isDirectory[0] != 0) { return 1; } else if (popup != null) { String fileName = path.lastPathComponent().getString(); int filterIndex = (int) popup.indexOfSelectedItem(); String extensions = filterExtensions [filterIndex]; int start = 0, length = extensions.length (); while (start < length) { int index = extensions.indexOf (EXTENSION_SEPARATOR, start); if (index == -1) index = length; String filter = extensions.substring (start, index).trim (); if (filter.equalsIgnoreCase (fileName)) return 1; if (filter.equals ("*") || filter.equals ("*.*")) return 1; if (filter.startsWith ("*.")) filter = filter.substring (2); if ((fileName.toLowerCase ()).endsWith("." + filter.toLowerCase ())) return 1; start = index + 1; } return 0; } } } return 1; }
Source:
<code>public int getRequiredPermissionLevel() { int level = 0; for (ICommand command : getSubCommands()) { if (command instanceof CommandBase) { <START> level = Math.max(level, ((CommandBase) command).getRequiredPermissionLevel()); <END> } } return level; }</code><technical_language>This method return minimum permission maximum</technical_language>

Target:
public int getRequiredPermissionLevel() { int level = super.getRequiredPermissionLevel(); for (ICommand command : getSortedCommandList()) { if (command instanceof CommandBase) { level = Math.min(level, ((CommandBase) command).getRequiredPermissionLevel()); } } return level; }
Source:
<code>public InfluxDBImpl(final String url, final String username, final String password, final OkHttpClient.Builder client, final ResponseFormat responseFormat) { this.hostAddress = parseHostAddress(url); this.username = username; this.password = password; this.loggingInterceptor = new HttpLoggingInterceptor(); setLogLevel(LOG_LEVEL); this.gzipRequestInterceptor = new GzipRequestInterceptor(); client.addInterceptor(loggingInterceptor).addInterceptor(gzipRequestInterceptor); Factory converterFactory = null; switch (responseFormat) { case MSGPACK: client.addInterceptor(chain -> { Request request = chain.request().newBuilder().addHeader("Accept", APPLICATION_MSGPACK) .addHeader("Accept-Encoding", "identity").build(); return chain.proceed(request); }); converterFactory = MessagePackConverterFactory.create(); chunkProccesor = new MessagePackChunkProccesor(); break; case JSON: default: converterFactory = MoshiConverterFactory.create(); Moshi moshi = new Moshi.Builder().build(); JsonAdapter<QueryResult> adapter = moshi.adapter(QueryResult.class); chunkProccesor = new JSONChunkProccesor(adapter); break; } this.retrofit = new Retrofit.Builder().baseUrl(url).client(client.build()).addConverterFactory(converterFactory) .build(); this.influxDBService = this.retrofit.create(InfluxDBService.class); <START> if (ResponseFormat.MSGPACK.equals(responseFormat)) { <END> String[] versionNumbers = version().split("\\."); final int major = Integer.parseInt(versionNumbers[0]); final int minor = Integer.parseInt(versionNumbers[1]); final int fromMinor = 4; if ((major < 2) && ((major != 1) || (minor < fromMinor))) { throw new InfluxDBException("MessagePack format is only supported from InfluxDB version 1.4 and later"); } } }</code><technical_language>This method tested more easily</technical_language>

Target:
public InfluxDBImpl(final String url, final String username, final String password, final OkHttpClient.Builder client, final ResponseFormat responseFormat) { this.messagePack = ResponseFormat.MSGPACK.equals(responseFormat); this.hostAddress = parseHostAddress(url); this.username = username; this.password = password; this.loggingInterceptor = new HttpLoggingInterceptor(); setLogLevel(LOG_LEVEL); this.gzipRequestInterceptor = new GzipRequestInterceptor(); client.addInterceptor(loggingInterceptor).addInterceptor(gzipRequestInterceptor); Factory converterFactory = null; switch (responseFormat) { case MSGPACK: client.addInterceptor(chain -> { Request request = chain.request().newBuilder().addHeader("Accept", APPLICATION_MSGPACK) .addHeader("Accept-Encoding", "identity").build(); return chain.proceed(request); }); converterFactory = MessagePackConverterFactory.create(); chunkProccesor = new MessagePackChunkProccesor(); break; case JSON: default: converterFactory = MoshiConverterFactory.create(); Moshi moshi = new Moshi.Builder().build(); JsonAdapter<QueryResult> adapter = moshi.adapter(QueryResult.class); chunkProccesor = new JSONChunkProccesor(adapter); break; } this.retrofit = new Retrofit.Builder().baseUrl(url).client(client.build()).addConverterFactory(converterFactory) .build(); this.influxDBService = this.retrofit.create(InfluxDBService.class); }
Source:
<code><START> private void handleYieldExpression(SubscriptionContext ctx, PyYieldExpressionTree yieldExpr) { <END> if (yieldExpr.fromKeyword() == null && yieldExpr.expressions().size() == 1) { yieldExpr.expressions().forEach(e -> checkExpr(e, ctx, "yield")); } }</code><technical_language>This method static</technical_language>

Target:
private static void handleYieldExpression(SubscriptionContext ctx, PyYieldExpressionTree yieldExpr) { if (yieldExpr.fromKeyword() == null && yieldExpr.expressions().size() == 1) { yieldExpr.expressions().forEach(e -> checkExpr(e, ctx, "yield")); } }
Source:
<code>private MyModel[] createModel() { <START> MyModel[] elements = new MyModel[10]; <END> for (int i = 0; i < elements.length; i++) { elements[i] = new MyModel(i); } return elements; }</code><technical_language>Lists</technical_language>

Target:
private List<MyModel> createModel() { List<MyModel> elements = new ArrayList<MyModel>(); for (int i = 0; i < 10; i++) { elements.add(new MyModel(i)); } return elements; }
Source:
<code>public int hashCode() { int hash = 7; <START> hash = hash * 31 + (name != null ? name.hashCode() : 0); <END> hash = hash * 31 + (type != null ? type.hashCode() : 0); hash = hash * 31 + (toCommandLine() != null ? toCommandLine().hashCode() : 0); return hash; }</code><technical_language>_Objects.hashCode(name)_ instead of _(name != null ? name.hashCode() : 0)_ for other similar code</technical_language>

Target:
public int hashCode() { return Objects.hash(getName(), getType().getId(), toCommandLine()); }
Source:
<code>public synchronized void startup() throws DatastreamException { if (_jmxReporter != null) { _jmxReporter.start(); } if (_coordinator != null) { _coordinator.start(); } try { _jettyLauncher.start(); _httpPort = _jettyLauncher.getPort(); _isStarted = true; } catch (IOException ex) { String errorMessage = "Failed to start netty."; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, ex); <START> } catch (Exception e) { <END> e.printStackTrace(); } }</code><technical_language>I understand intention of lines</technical_language>

Target:
public synchronized void startup() throws DatastreamException { if (_jmxReporter != null) { _jmxReporter.start(); } if (_coordinator != null) { _coordinator.start(); } try { _jettyLauncher.start(); _httpPort = _jettyLauncher.getPort(); _isStarted = true; } catch (Exception ex) { String errorMessage = "Failed to start netty."; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, ex); } }
Source:
<code><START> private TreeMap<String, String> mapGiverNameToGiverEmail(String courseId, Set<String> giverEmails) { <END> TreeMap<String, String> giverEmailToGiverNameMap = new TreeMap<String, String>(); giverEmailToGiverNameMap.put(InstructorStudentRecordsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST, Const.DISPLAYED_NAME_FOR_SELF_IN_COMMENTS); giverEmailToGiverNameMap.put("Anonymous", "Anonymous"); for (String giverEmail : giverEmails) { if (!giverEmailToGiverNameMap.containsKey(giverEmail)) { InstructorAttributes giverInstructor = logic.getInstructorForEmail(courseId, giverEmail); Assumption.assertNotNull(giverInstructor); giverEmailToGiverNameMap.put(giverEmail, giverInstructor.displayedName + " " + giverInstructor.name); } } return giverEmailToGiverNameMap; }</code><technical_language>(And a other parts too, variable types, parameter types etc)</technical_language>

Target:
private Map<String, String> mapGiverNameToGiverEmail(String courseId, Set<String> giverEmails) { Map<String, String> giverEmailToGiverNameMap = new HashMap<String, String>(); giverEmailToGiverNameMap.put(InstructorStudentRecordsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST, Const.DISPLAYED_NAME_FOR_SELF_IN_COMMENTS); giverEmailToGiverNameMap.put(Const.DISPLAYED_NAME_FOR_ANONYMOUS_COMMENT_PARTICIPANT, Const.DISPLAYED_NAME_FOR_ANONYMOUS_COMMENT_PARTICIPANT); for (String giverEmail : giverEmails) { if (!giverEmailToGiverNameMap.containsKey(giverEmail)) { InstructorAttributes giverInstructor = logic.getInstructorForEmail(courseId, giverEmail); Assumption.assertNotNull(giverInstructor); giverEmailToGiverNameMap.put(giverEmail, giverInstructor.displayedName + " " + giverInstructor.name); } } return giverEmailToGiverNameMap; }
Source:
<code>public void processAllMessages() throws MessageMonitoringDAOException { LOG.debug("Inside Message Monitoring API checkAndUpdateMessageStatus() method."); List<MonitoredMessage> failedMessages = getAllFailedMessages(); for (MonitoredMessage trackMessage : failedMessages) { sendFailedEdgeNotification(trackMessage); messageMonitoringCache.remove(trackMessage.getMessageid()); if (getDirectTestFlag(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DIRECTTESTING_FLAG)) { trackMessage.setStatus(STATUS_ARCHIVED); getMessageMonitoringDAO().updateOutgoingMessage(trackMessage); } else { deleteFromMessageMonitoringDB(trackMessage); } } List<MonitoredMessage> completedMessages = getAllCompletedMessages(); for (MonitoredMessage trackMessage : completedMessages) { sendSuccessEdgeNotification(trackMessage); messageMonitoringCache.remove(trackMessage.getMessageid()); if (getDirectTestFlag(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DIRECTTESTING_FLAG)) { trackMessage.setStatus(STATUS_ARCHIVED); getMessageMonitoringDAO().updateOutgoingMessage(trackMessage); } else { deleteFromMessageMonitoringDB(trackMessage); } } <START> deleteElapsedArchivedMessage(); <END> LOG.debug("Exiting Message Monitoring API checkAndUpdateMessageStatus() method."); }</code><technical_language>this method is called direct testing flag is enabled</technical_language>

Target:
public void processAllMessages() throws MessageMonitoringDAOException { LOG.debug("Inside Message Monitoring API checkAndUpdateMessageStatus() method."); List<MonitoredMessage> failedMessages = getAllFailedMessages(); for (MonitoredMessage trackMessage : failedMessages) { sendFailedEdgeNotification(trackMessage); messageMonitoringCache.remove(trackMessage.getMessageid()); if (getDirectTestFlag(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DIRECTTESTING_FLAG)) { deleteElapsedArchivedMessageList(); trackMessage.setStatus(STATUS_ARCHIVED); getMessageMonitoringDAO().updateOutgoingMessage(trackMessage); } else { deleteFromMessageMonitoringDB(trackMessage); } } List<MonitoredMessage> completedMessages = getAllCompletedMessages(); for (MonitoredMessage trackMessage : completedMessages) { sendSuccessEdgeNotification(trackMessage); messageMonitoringCache.remove(trackMessage.getMessageid()); if (getDirectTestFlag(NhincConstants.GATEWAY_PROPERTY_FILE, NhincConstants.DIRECTTESTING_FLAG)) { deleteElapsedArchivedMessageList(); trackMessage.setStatus(STATUS_ARCHIVED); getMessageMonitoringDAO().updateOutgoingMessage(trackMessage); } else { deleteFromMessageMonitoringDB(trackMessage); } } LOG.debug("Exiting Message Monitoring API checkAndUpdateMessageStatus() method."); }
Source:
<code>protected void shutdownService() { scheduler.clearTasks(); selector.wakeup(); selector.wakeup(); try { if(selector != null && selector.isOpen()) { selector.close(); } <START> } catch (Exception e) { <END> } clients.clear(); servers.clear(); }</code><technical_language>swallowing exception here</technical_language>

Target:
protected void shutdownService() { scheduler.clearTasks(); selector.wakeup(); selector.wakeup(); try { if(selector != null && selector.isOpen()) { selector.close(); } } catch (Exception e) { ExceptionUtils.handleException(e); } clients.clear(); servers.clear(); }
Source:
<code>protected boolean isToSkip(FactMapping factMapping) { return OTHER.equals(factMapping.getExpressionIdentifier().getType()) || EMPTY.equals(factMapping.getFactIdentifier()) || <START> factMapping.getExpressionElements().size() == 0; <END> }</code><technical_language>for sake of short codebase .size() == 0 replaced .isEmpty()</technical_language>

Target:
public static boolean isToSkip(FactMapping factMapping) { return OTHER.equals(factMapping.getExpressionIdentifier().getType()) || EMPTY.equals(factMapping.getFactIdentifier()) || factMapping.getExpressionElements().isEmpty(); }
Source:
<code>protected void skipRegistration(Server server) { <START> addParamsToCDKLaunchConfig(server, "--skip-registration"); END> }</code><technical_language>@odockal please move this constant</technical_language>

Target:
protected void skipRegistration(Server server) { addParamsToCDKLaunchConfig(server, SKIP_REGISTRATION); }
Source:
<code>public JobPropertyImpl(Set<String> activeProcessNames) throws Descriptor.FormException, IOException { <START> this.activeProcessNames.addAll(activeProcessNames); <END> }</code><technical_language>I move validation/modification code another constructor here. other hand remove exception throwing annotate this constructor <code>@Restricted(NoExternalUse.class)</code></technical_language>

Target:
public JobPropertyImpl(Set<String> activeProcessNames) { this.activeProcessNames.addAll(activeProcessNames); }
Source:
<code>public synchronized void destroy() { LOG.info("{} is stopping.", NAME); for (Listener listener : listeners) { try { LOG.info("Stopping listener.", listener.getName()); listener.stop(); } catch (InterruptedException e) { LOG.warn("Error while stopping listener.", e); } } listeners.clear(); for (AsyncDispatcher<?> dispatcher : dispatchers) { try { LOG.debug("Closing dispatcher.", dispatcher); } catch (Exception e) { LOG.warn("Error while closing dispatcher.", e); } } <START> listeners.clear(); <END> for (TelemetryMessageConsumer consumer : consumers) { try { LOG.info("Stopping consumer for protocol.", consumer.getProtocol().getName()); messageConsumerManager.unregisterConsumer(consumer); } catch (Exception e) { LOG.error("Error while stopping consumer.", e); } } consumers.clear(); LOG.info("{} is stopped.", NAME); }</code><technical_language>This dispatchers.clear()</technical_language>

Target:
public synchronized void destroy() { LOG.info("{} is stopping.", NAME); for (Listener listener : listeners) { try { LOG.info("Stopping listener.", listener.getName()); listener.stop(); } catch (InterruptedException e) { LOG.warn("Error while stopping listener.", e); } } listeners.clear(); for (AsyncDispatcher<?> dispatcher : dispatchers) { try { LOG.info("Closing dispatcher.", dispatcher); dispatcher.close(); } catch (Exception e) { LOG.warn("Error while closing dispatcher.", e); } } dispatchers.clear(); for (TelemetryMessageConsumer consumer : consumers) { try { LOG.info("Stopping consumer for protocol.", consumer.getProtocol().getName()); messageConsumerManager.unregisterConsumer(consumer); } catch (Exception e) { LOG.error("Error while stopping consumer.", e); } } consumers.clear(); LOG.info("{} is stopped.", NAME); }
Source:
<code><START> public CRAMFileWriter(final OutputStream outputStream, final OutputStream indexOS, final ReferenceSource source, final SAMFileHeader samFileHeader, final String fileName) { <END> this.outputStream = outputStream; this.samFileHeader = samFileHeader; this.fileName = fileName; initCRAMWriter(indexOS, source, samFileHeader, true); }</code><technical_language>this constructor delegate it</technical_language>

Target:
public CRAMFileWriter( final OutputStream outputStream, final OutputStream indexOS, final ReferenceSource source, final SAMFileHeader samFileHeader, final String fileName) { this(outputStream, indexOS, true, source, samFileHeader, fileName); }
Source:
<code>public Socket connectSocket( final Socket sock, final String host, final int port, final InetAddress localAddress, int localPort, final HttpParams params ) throws IOException { if (host == null) { throw new IllegalArgumentException("Target host may not be null."); } if (params == null) { throw new IllegalArgumentException("Parameters may not be null."); } SSLSocket sslsock = (SSLSocket) ((sock != null) ? sock : createSocket()); if ((localAddress != null) || (localPort > 0)) { if (localPort < 0) localPort = 0; InetSocketAddress isa = new InetSocketAddress(localAddress, localPort); sslsock.bind(isa); } int connTimeout = HttpConnectionParams.getConnectionTimeout(params); int soTimeout = HttpConnectionParams.getSoTimeout(params); InetSocketAddress remoteAddress; if (nameResolver != null) { remoteAddress = new InetSocketAddress(nameResolver.resolve(host), port); } else { remoteAddress = new InetSocketAddress(host, port); } sslsock.connect(remoteAddress, connTimeout); sslsock.setSoTimeout(soTimeout); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { socketfactory.setHostname(sslsock, host); } <START> <END> try { hostnameVerifier.verify(host, sslsock); } catch (IOException iox) { try { sslsock.close(); } catch (Exception x) { } throw iox; } return sslsock; }</code><technical_language>Please invoke SSLSocket.startHandshake() ensure exceptions thrown handshake do get silenced rethrown SSLPeerUnverifiedException hostname verification code below. is caused HostnameVerifier code invalid SSLSession handshake occurs throwing SSLPeerUnverifiedException</technical_language>

Target:
public Socket connectSocket( final Socket sock, final String host, final int port, final InetAddress localAddress, int localPort, final HttpParams params ) throws IOException { if (host == null) { throw new IllegalArgumentException("Target host may not be null."); } if (params == null) { throw new IllegalArgumentException("Parameters may not be null."); } SSLSocket sslsock = (SSLSocket) ((sock != null) ? sock : createSocket()); if ((localAddress != null) || (localPort > 0)) { if (localPort < 0) localPort = 0; InetSocketAddress isa = new InetSocketAddress(localAddress, localPort); sslsock.bind(isa); } int connTimeout = HttpConnectionParams.getConnectionTimeout(params); int soTimeout = HttpConnectionParams.getSoTimeout(params); InetSocketAddress remoteAddress; if (nameResolver != null) { remoteAddress = new InetSocketAddress(nameResolver.resolve(host), port); } else { remoteAddress = new InetSocketAddress(host, port); } sslsock.connect(remoteAddress, connTimeout); sslsock.setSoTimeout(soTimeout); setSocketHostname(sslsock, host); try { hostnameVerifier.verify(host, sslsock); } catch (IOException iox) { try { sslsock.close(); } catch (Exception x) { } throw iox; } return sslsock; }
Source:
<code>public void createControl(final Composite parent) { super.createControl(parent); <START> Composite composite = (Composite) getControl(); <END> composite.setLayoutData(new GridData(SWT.FILL, SWT.DOWN, true, false)); GridLayout gridLayout = new GridLayout(1, false); composite.setLayout(gridLayout); setControl(composite); Group group = createGroup(composite, Messages.NattableConfigurationProjectCreationPage_nattableConfigurationFileNameLabel); nattableConfigurationFileName = new Text(group, SWT.BORDER); nattableConfigurationFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nattableConfigurationFileName.addListener(SWT.Modify, fileNameModifyListener); setPageComplete(false); }</code><technical_language>final</technical_language>

Target:
public void createControl(final Composite parent) { super.createControl(parent); final Composite composite = (Composite) getControl(); composite.setLayoutData(new GridData(SWT.FILL, SWT.DOWN, true, false)); final GridLayout gridLayout = new GridLayout(1, false); composite.setLayout(gridLayout); setControl(composite); final Group group = createGroup(composite, Messages.NattableConfigurationProjectCreationPage_nattableConfigurationFileNameLabel); nattableConfigurationFileName = new Text(group, SWT.BORDER); nattableConfigurationFileName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nattableConfigurationFileName.addListener(SWT.Modify, fileNameModifyListener); setPageComplete(false); }
Source:
<code>public static JDBCConfiguration asJDBCConfiguration(OxdServerConfiguration configuration) { try { JsonNode node = configuration.getStorageConfiguration(); if (node != null) { return Jackson2.createJsonMapper().treeToValue(node, JDBCConfiguration.class); } } catch (Exception e) { LOG.error("Failed to parse JDBCConfiguration.", e); } <START> return new JDBCConfiguration(); <END> }</code><technical_language>throw error here. I imagine do empty configuration</technical_language>

Target:
public static JDBCConfiguration asJDBCConfiguration(OxdServerConfiguration configuration) throws Exception { try { JsonNode node = configuration.getStorageConfiguration(); if (node != null) { return Jackson2.createJsonMapper().treeToValue(node, JDBCConfiguration.class); } LOG.error("JDBC Configuration not provided."); throw new Exception("JDBC configuration not provided in `oxd-server.yml`."); } catch (Exception e) { LOG.error("Failed to parse JDBCConfiguration.", e); throw e; } }
Source:
<code><START> public void removeVideoFromArticle() { <END> String articleName = PageContent.ARTICLE_NAME_PREFIX + DateTime.now().getMillis(); VisualEditorPageObject ve = new VisualEditorPageObject(driver).openVEOnArticle(wikiURL, articleName); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); VisualEditorAddMediaDialog mediaDialog = ve.clickVideoButton(); VisualEditorPageObject veNew = mediaDialog.addMediaByURL(VideoContent.NON_PREMIUM_VIDEO_URL); veNew.verifyVideos(1); veNew.verifyVEToolBarPresent(); VisualEditorSaveChangesDialog save = veNew.clickPublishButton(); ArticlePageObject article = save.savePage(); article.verifyVEPublishComplete(); ve.openVEOnArticle(wikiURL, articleName); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.selectMediaAndDelete(); ve.verifyNoVideo(); save = ve.clickPublishButton(); article = save.savePage(); article.verifyVEPublishComplete(); }</code><technical_language>This test is failing production</technical_language>

Target:
public void removeVideoFromArticle() { String articleName = PageContent.ARTICLE_NAME_PREFIX + DateTime.now().getMillis(); VisualEditorPageObject ve = new VisualEditorPageObject(driver).openVEOnArticle(wikiURL, articleName); VisualEditorPageObject veNew = ve.addVideoToContent(VideoContent.NON_PREMIUM_VIDEO_URL); veNew.verifyVideos(1); veNew.publish(); ve.openVEOnArticle(wikiURL, articleName); ve.verifyVEToolBarPresent(); ve.verifyEditorSurfacePresent(); ve.selectMediaAndDelete(); ve.verifyNoVideo(); ve.publish(); }
Source:
<code><START> private DocumentRevisionTree getAllRevisionsOfDocumentInQueue(SQLDatabase db, String docId) throws DocumentNotFoundException, AttachmentException { <END> String sql = "SELECT " + FULL_DOCUMENT_COLS + " FROM revs, docs " + "WHERE docs.docid=? AND revs.doc_id = docs.doc_id ORDER BY sequence ASC"; String[] args = {docId}; Cursor cursor = null; try { DocumentRevisionTree tree = new DocumentRevisionTree(); cursor = db.rawQuery(sql, args); while (cursor.moveToNext()) { long sequence = cursor.getLong(3); List<? extends Attachment> atts = attachmentManager.attachmentsForRevision(db,sequence); BasicDocumentRevision rev = getFullRevisionFromCurrentCursor(cursor, atts); logger.finer("Rev: " + rev); tree.add(rev); } return tree; } catch (SQLException e) { logger.log(Level.SEVERE, "Error getting all revisions of document", e); throw new DocumentNotFoundException("DocumentRevisionTree not found with id: " + docId, e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } }</code><technical_language>Some long lines throws clauses,</technical_language>

Target:
private DocumentRevisionTree getAllRevisionsOfDocumentInQueue(SQLDatabase db, String docId) throws DocumentNotFoundException, AttachmentException, DatastoreException { String sql = "SELECT " + FULL_DOCUMENT_COLS + " FROM revs, docs " + "WHERE docs.docid=? AND revs.doc_id = docs.doc_id ORDER BY sequence ASC"; String[] args = {docId}; Cursor cursor = null; try { DocumentRevisionTree tree = new DocumentRevisionTree(); cursor = db.rawQuery(sql, args); while (cursor.moveToNext()) { long sequence = cursor.getLong(3); List<? extends Attachment> atts = attachmentManager.attachmentsForRevision(db,sequence); BasicDocumentRevision rev = getFullRevisionFromCurrentCursor(cursor, atts); logger.finer("Rev: " + rev); tree.add(rev); } return tree; } catch (SQLException e) { logger.log(Level.SEVERE, "Error getting all revisions of document", e); throw new DatastoreException("DocumentRevisionTree not found with id: " + docId, e); } finally { DatabaseUtils.closeCursorQuietly(cursor); } }