auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private boolean InitializeStorage() { boolean returnValue = false; if (getStoragePool() == null || StoragePoolStatus.Uninitialized == getStoragePool().getStatus() || StoragePoolStatus.Maintenance == getStoragePool().getStatus()) { returnValue = true; connectPoolSucceeded = true; } else { ConnectHostToStoragePoolServersParameters params = new ConnectHostToStoragePoolServersParameters(getStoragePool(), getVds()); Backend.getInstance().runInternalAction(VdcActionType.ConnectHostToStoragePoolServers, params); EventResult connectResult = connectHostToPool(); returnValue = connectResult == null ? false : connectResult.isSuccess(); connectPoolSucceeded = returnValue; if (!returnValue) { <START> problematicDomains = (List<StorageDomainStatic>) connectResult.getResultData(); <END> } } return returnValue; }</code><technical_language>this part safe enough - if connectResult is null (there's some protection in line 216..) , NPE, uniformity here..either null not</technical_language>

Target:
private boolean InitializeStorage() { boolean returnValue = false; if (getStoragePool() == null || StoragePoolStatus.Uninitialized == getStoragePool().getStatus() || StoragePoolStatus.Maintenance == getStoragePool().getStatus()) { returnValue = true; connectPoolSucceeded = true; } else { ConnectHostToStoragePoolServersParameters params = new ConnectHostToStoragePoolServersParameters(getStoragePool(), getVds()); Backend.getInstance().runInternalAction(VdcActionType.ConnectHostToStoragePoolServers, params); EventResult connectResult = connectHostToPool(); if (connectResult != null) { returnValue = connectResult.isSuccess(); problematicDomains = (List<StorageDomainStatic>) connectResult.getResultData(); } connectPoolSucceeded = returnValue; } return returnValue; }
Source:
<code>public Definitions toDefinitions() { Definitions definitions = bpmn2.createDefinitions(); DefinitionsPropertyWriter p = propertyWriterFactory.of(definitions); ProcessPropertyWriter pp = processConverter.convertProcess(); Node<Definition<BPMNDiagram>, ?> node = converterFactory.context.firstNode(); BPMNDiagram definition = node.getContent().getDefinition(); BaseDiagramSet diagramSet = definition.getDiagramSet(); p.setExporter("jBPM Process Modeler"); p.setExporterVersion("2.0"); p.setProcess(pp.getProcess()); p.setDiagram(pp.getBpmnDiagram()); p.setRelationship(pp.getRelationship()); p.setWSDLImports(diagramSet.getImports().getValue().getWSDLImports()); p.addAllRootElements(pp.getItemDefinitions()); p.addAllRootElements(pp.getRootElements()); p.addAllRootElements(pp.getInterfaces()); <START> pp.getProcess().getFlowElements().addAll(pp.getDataObjects()); <END> return definitions; }</code><technical_language>this sense? setting pp instance, pp instance well... is p playing role here? lines, this incoherent I this change in DefinitionsConverter class for client side marshallers</technical_language>

Target:
public Definitions toDefinitions() { Definitions definitions = bpmn2.createDefinitions(); DefinitionsPropertyWriter p = propertyWriterFactory.of(definitions); ProcessPropertyWriter pp = processConverter.convertProcess(); Node<Definition<BPMNDiagram>, ?> node = converterFactory.context.firstNode(); BPMNDiagram definition = node.getContent().getDefinition(); BaseDiagramSet diagramSet = definition.getDiagramSet(); p.setExporter("jBPM Process Modeler"); p.setExporterVersion("2.0"); p.setProcess(pp.getProcess()); p.setDiagram(pp.getBpmnDiagram()); p.setRelationship(pp.getRelationship()); p.setWSDLImports(diagramSet.getImports().getValue().getWSDLImports()); p.addAllRootElements(pp.getItemDefinitions()); p.addAllRootElements(pp.getRootElements()); p.addAllRootElements(pp.getInterfaces()); return definitions; }
Source:
<code>public void actionPerformed(ActionEvent arg0) { Layouts layoutType = (Layouts) jcb.getSelectedItem(); try { Network network = g_array[graph_index]; Layout<Integer> layout = createLayout(layoutType, network); layout.setInitializer(vv.getGraphLayout()); layout.setSize(vv.getSize()); System.err.println("using graph " + graph_names[graph_index]); <START> System.err.println("using layout: " + layout.getClass()); <END> LayoutTransition<Integer, Number> lt = new LayoutTransition<Integer, Number>( vv, vv.getModel().getLayoutMediator(), new LayoutMediator(network, layout)); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>@tomnelson a bit puzzled System.err.println statements. leave in? If so, explain reasoning me</technical_language>

Target:
public void actionPerformed(ActionEvent arg0) { Layouts layoutType = (Layouts) jcb.getSelectedItem(); try { Network network = g_array[graph_index]; Layout<Integer> layout = createLayout(layoutType, network); layout.setInitializer(vv.getGraphLayout()); layout.setSize(vv.getSize()); LayoutTransition<Integer, Number> lt = new LayoutTransition<Integer, Number>( vv, vv.getModel().getLayoutMediator(), new LayoutMediator(network, layout)); Animator animator = new Animator(lt); animator.start(); vv.getRenderContext().getMultiLayerTransformer().setToIdentity(); vv.repaint(); } catch (Exception e) { e.printStackTrace(); } }
Source:
<code>void init(Drawable drawable, GCData data, long gdkGC) { if (GTK.GTK3) { if (data.foregroundRGBA != null) data.state &= ~FOREGROUND; if (data.backgroundRGBA != null) data.state &= ~(BACKGROUND | BACKGROUND_BG); } else { if (data.foreground != null) data.state &= ~FOREGROUND; if (data.background != null) data.state &= ~(BACKGROUND | BACKGROUND_BG); } if (data.font != null) data.state &= ~FONT; Image image = data.image; if (image != null) { image.memGC = this; if (image.transparentPixel != -1) image.destroyMask(); } this.drawable = drawable; this.data = data; handle = gdkGC; long cairo = data.cairo = handle; Cairo.cairo_set_fill_rule(cairo, Cairo.CAIRO_FILL_RULE_EVEN_ODD); data.state &= ~(BACKGROUND | FOREGROUND | FONT | LINE_WIDTH | LINE_CAP | LINE_JOIN | LINE_STYLE | DRAW_OFFSET); setClipping(data.clipRgn); initCairo(); if ((data.style & SWT.MIRRORED) != 0) { if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0) && OS.CAIRO_CONTEXT_REUSE) { int[] w = new int[1], h = new int[1]; getSize(w, h); Cairo.cairo_translate(cairo, w[0], 0); Cairo.cairo_scale(cairo, -1.0, 1.0); } else { Cairo.cairo_set_matrix(data.cairo, identity()); } } <START> if (cairoTransformationMatrix == null) cairoTransformationMatrix = new double[6]; Cairo.cairo_get_matrix(data.cairo, cairoTransformationMatrix); clipping = getClipping(); <END> }</code><technical_language>This block guarded if(OS.CAIRO_CONTEXT_REUSE)</technical_language>

Target:
void init(Drawable drawable, GCData data, long gdkGC) { if (GTK.GTK3) { if (data.foregroundRGBA != null) data.state &= ~FOREGROUND; if (data.backgroundRGBA != null) data.state &= ~(BACKGROUND | BACKGROUND_BG); } else { if (data.foreground != null) data.state &= ~FOREGROUND; if (data.background != null) data.state &= ~(BACKGROUND | BACKGROUND_BG); } if (data.font != null) data.state &= ~FONT; Image image = data.image; if (image != null) { image.memGC = this; if (image.transparentPixel != -1) image.destroyMask(); } this.drawable = drawable; this.data = data; handle = gdkGC; long cairo = data.cairo = handle; Cairo.cairo_set_fill_rule(cairo, Cairo.CAIRO_FILL_RULE_EVEN_ODD); data.state &= ~(BACKGROUND | FOREGROUND | FONT | LINE_WIDTH | LINE_CAP | LINE_JOIN | LINE_STYLE | DRAW_OFFSET); setClipping(data.clipRgn); initCairo(); if ((data.style & SWT.MIRRORED) != 0) { if (GTK.GTK_VERSION >= OS.VERSION (3, 14, 0) && OS.CAIRO_CONTEXT_REUSE) { int[] w = new int[1], h = new int[1]; getSize(w, h); Cairo.cairo_translate(cairo, w[0], 0); Cairo.cairo_scale(cairo, -1.0, 1.0); } else { Cairo.cairo_set_matrix(data.cairo, identity()); } } if (OS.CAIRO_CONTEXT_REUSE) { if (cairoTransformationMatrix == null) cairoTransformationMatrix = new double[6]; Cairo.cairo_get_matrix(data.cairo, cairoTransformationMatrix); clipping = getClipping(); } }
Source:
<code>public PomJsonReaderDefault(String path, String jsonName) { String jsonPath = path + jsonName; if (!Files.exists(Paths.get(jsonPath))) { throw new RuntimeException("no " + jsonName + " in the provided path :" + path); } InputStream fis = null; JsonReader reader = null; try { <START> fis = new FileInputStream(jsonPath); <END> reader = Json.createReader(fis); pomObject = reader.readObject(); reader.close(); } catch (Exception e) { logger.error(e.getMessage()); throw new RuntimeException(e.getMessage()); } finally { if (fis != null) { try { fis.close(); } catch (IOException ex) { logger.warn(ex.getMessage(), ex); } } if (reader != null) { reader.close(); } } }</code><technical_language>Consider try-with-resources</technical_language>

Target:
public PomJsonReaderDefault(String path, String jsonName) { String jsonPath = path + jsonName; if (!Files.exists(Paths.get(jsonPath))) { throw new RuntimeException("no " + jsonName + " in the provided path :" + path); } try (FileInputStream fis = new FileInputStream(jsonPath); JsonReader reader = Json.createReader(fis)) { pomObject = reader.readObject(); } catch (Exception e) { logger.error(e.getMessage()); throw new RuntimeException(e.getMessage()); } }
Source:
<code>public static void main(String[] args) { SpringApplication application = new SpringApplication(); String command = extractCommand(args); <START> if ("initHome".equals(command)) { <END> application.setSources(Collections.<Object>singleton(InitHome.class)); application.setWebEnvironment(false); } else { application.setSources(Collections.<Object>singleton(Osiam.class)); application.addListeners(new OsiamHome()); } application.setDefaultProperties(DEFAULT_PROPERTIES); application.run(args); }</code><technical_language>a huge fan of Yoda notation</technical_language>

Target:
public static void main(String[] args) { SpringApplication application = new SpringApplication(); String command = extractCommand(args); if ("initHome".equals(command)) { application.setSources(Collections.<Object>singleton(InitHome.class)); application.setWebEnvironment(false); } else { application.setSources(Collections.<Object>singleton(Osiam.class)); } application.addListeners(new OsiamHome()); application.setDefaultProperties(DEFAULT_PROPERTIES); application.run(args); }
Source:
<code>public void testUploadWithAllParametersSet() throws IOException { String key = getRandomString(); String bucket = getRandomString(); transferUtility.upload(key, inputStream, UploadOptions.builder() .bucket(bucket) .objectMetadata(metadata) .cannedAcl(cannedAcl) .transferListener(listener) .build()); verify(transferUtility, times(1)).upload(eq(bucket), eq(key), any(File.class), eq(metadata), eq(cannedAcl), eq(listener)); <START> transferUtility.getDbUtil().closeDB(); <END> }</code><technical_language>tearDown() method is called test case, this called anyways. remove this line</technical_language>

Target:
public void testUploadWithAllParametersSet() throws IOException { String key = getRandomString(); String bucket = getRandomString(); transferUtility.upload(key, inputStream, UploadOptions.builder() .bucket(bucket) .objectMetadata(metadata) .cannedAcl(cannedAcl) .transferListener(listener) .build()); verify(transferUtility, times(1)).upload(eq(bucket), eq(key), any(File.class), eq(metadata), eq(cannedAcl), eq(listener)); }
Source:
<code>public static void showGutenbergCompatibilityWarningDialog(Context ctx, FragmentManager fragmentManager, PostModel post, SiteModel site) { GutenbergWarningFragmentDialog gutenbergCompatibilityDialog = new GutenbergWarningFragmentDialog(); gutenbergCompatibilityDialog.initialize(TAG_GUTENBERG_CONFIRM_DIALOG, post.isPage(), post.getRemotePostId()); gutenbergCompatibilityDialog.show(fragmentManager, TAG_GUTENBERG_CONFIRM_DIALOG); <START> Map<String, Object> properties = new HashMap<>(); <END> if (!post.isLocalDraft()) { properties.put("post_id", post.getRemotePostId()); } properties.put("is_page", post.isPage()); properties.put(AnalyticsUtils.HAS_GUTENBERG_BLOCKS_KEY, true); AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.GUTENBERG_WARNING_CONFIRM_DIALOG_SHOWN, site, properties); }</code><technical_language>re-use trackGutenbergDialogEvent() method defined in file below</technical_language>

Target:
public static void showGutenbergCompatibilityWarningDialog(Context ctx, FragmentManager fragmentManager, PostModel post, SiteModel site) { GutenbergWarningFragmentDialog gutenbergCompatibilityDialog = new GutenbergWarningFragmentDialog(); gutenbergCompatibilityDialog.initialize(post.getRemotePostId(), post.isPage()); gutenbergCompatibilityDialog.show(fragmentManager, "tag_gutenberg_confirm_dialog"); trackGutenbergDialogEvent(AnalyticsTracker.Stat.GUTENBERG_WARNING_CONFIRM_DIALOG_SHOWN, post, site); }
Source:
<code>private double calcSilhouetteCoefficient(double d1, double d2) { if (d1 < d2) { return 1.0 - (d1 / d2); } else if (d1 == d2) { <START> return 0; <END> } else { return (d2 / d1) - 1.0; } }</code><technical_language>Nit: this 0.0 for clarity need elses here</technical_language>

Target:
private double calcSilhouetteCoefficient(double d1, double d2) { if (d1 < d2) { return 1.0 - (d1 / d2); } else if (d1 > d2) { return (d2 / d1) - 1.0; } return 0.0; }
Source:
<code><START> public boolean computeWithPrimaryLocked(Object key, Runnable r) <END> throws PrimaryBucketLockException { int bucketId = PartitionedRegionHelper.getHashKey(this, null, key, null, null); BucketRegion br; try { br = this.dataStore.getInitializedBucketForId(key, bucketId); } catch (ForceReattemptException e) { throw new BucketMovedException(e); } try { if (!br.doLockForPrimary(false)) { return false; } } catch (PrimaryBucketException e) { throw new PrimaryBucketLockException("retry since primary lock failed: " + e); } try { r.run(); } finally { br.doUnlockForPrimary(); } return true; }</code><technical_language>this longer return boolean (since rid of tryLock option)</technical_language>

Target:
public void computeWithPrimaryLocked(Object key, Runnable r) throws PrimaryBucketLockException { int bucketId = PartitionedRegionHelper.getHashKey(this, null, key, null, null); BucketRegion br; try { br = this.dataStore.getInitializedBucketForId(key, bucketId); } catch (ForceReattemptException e) { throw new BucketMovedException(e); } try { br.doLockForPrimary(false); } catch (PrimaryBucketException e) { throw new PrimaryBucketLockException("retry since primary lock failed: " + e); } try { r.run(); } finally { br.doUnlockForPrimary(); } }
Source:
<code>public boolean isObstructed() { Location current = getTopLeftCorner(); BlockFace right = getRightFace(); for (int y = 0; y < art.getBlockHeight(); y++) { for (int x = 0; x < art.getBlockWidth(); x++) { if (!canHoldPainting(current)) { return true; } current = current.getBlock().getRelative(right).getLocation(); } current = current.getBlock().getRelative(BlockFace.DOWN).getLocation(); <START> current.subtract(right.getModX() * art.getBlockWidth(), 0, right.getModZ() * art.getBlockWidth()); <END> } return !this.world.getEntityManager().getEntitiesInside(this.boundingBox, this).isEmpty(); }</code><technical_language>subtract, locations cloned updating them, IIRC update block's location (unless Spigot?)</technical_language>

Target:
public boolean isObstructed() { Location current = getTopLeftCorner(); BlockFace right = getRightFace(); for (int y = 0; y < art.getBlockHeight(); y++) { for (int x = 0; x < art.getBlockWidth(); x++) { if (!canHoldPainting(current)) { return true; } current = current.getBlock().getRelative(right).getLocation(); } current = current.getBlock().getRelative(BlockFace.DOWN).getLocation(); current.subtract(right.getModX() * art.getBlockWidth(), 0, right.getModZ() * art.getBlockWidth()); } List<Entity> entitiesInside = this.world.getEntityManager().getEntitiesInside(this.boundingBox, this); return entitiesInside.stream().anyMatch(e -> e instanceof Hanging); }
Source:
<code>public void onStreamCreate(IMediaStream stream) { logger.debug("onStreamCreate - [" + stream.getName() + "]"); <START> stream.addClientListener(actionListener); <END> }</code><technical_language>Is ok share listner</technical_language>

Target:
public void onStreamCreate(IMediaStream stream) { LiveStreamListener actionListener = new LiveStreamListener(); logger.debug("onStreamCreate - [" + stream.getName() + "]"); WMSProperties props = stream.getProperties(); synchronized (props) { props.setProperty(STREAM_ACTION_PROPERTY, actionListener); } stream.addClientListener(actionListener); }
Source:
<code>public void call(Iterator<BulkImportPartition> importPartitions) throws Exception { init(importPartitions); Configuration conf = HConfiguration.unwrapDelegate(); LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf); FileSystem fs = FileSystem.get(URI.create(bulkImportDirectory), conf); for (Long conglomId : partitionMap.keySet()) { PartitionFactory tableFactory= SIDriver.driver().getTableFactory(); Partition partition=tableFactory.getTable(Long.toString(conglomId)); List<BulkImportPartition> partitionList = partitionMap.get(conglomId); Path path = new Path(partitionList.get(0).getFilePath()); if (!fs.exists(path)) { fs.mkdirs(path); } for (int i = 1; i < partitionList.size(); ++i) { Path sourceDir = new Path(partitionList.get(i).getFilePath()); if (fs.exists(sourceDir)) { FileStatus[] statuses = fs.listStatus(sourceDir); for (FileStatus status : statuses) { Path filePath = status.getPath(); Path destPath = new Path(path, filePath.getName()); fs.rename(filePath, destPath); if (LOG.isDebugEnabled()) { <START> SpliceLogUtils.debug(LOG, "Move file %s to ", filePath.toString(), destPath.toString()); <END> } } fs.delete(sourceDir.getParent(), true); } } loader.doBulkLoad(path.getParent(), (HTable) ((SkeletonHBaseClientPartition)partition).unwrapDelegate()); fs.delete(path, true); } }</code><technical_language>"%s" is missing in debug message</technical_language>

Target:
public void call(Iterator<BulkImportPartition> importPartitions) throws Exception { init(importPartitions); Configuration conf = HConfiguration.unwrapDelegate(); LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf); FileSystem fs = FileSystem.get(URI.create(bulkImportDirectory), conf); PartitionFactory tableFactory= SIDriver.driver().getTableFactory(); for (Long conglomId : partitionMap.keySet()) { Partition partition=tableFactory.getTable(Long.toString(conglomId)); List<BulkImportPartition> partitionList = partitionMap.get(conglomId); Path path = new Path(partitionList.get(0).getFilePath()); if (!fs.exists(path)) { fs.mkdirs(path); } for (int i = 1; i < partitionList.size(); ++i) { Path sourceDir = new Path(partitionList.get(i).getFilePath()); if (fs.exists(sourceDir)) { FileStatus[] statuses = fs.listStatus(sourceDir); for (FileStatus status : statuses) { Path filePath = status.getPath(); Path destPath = new Path(path, filePath.getName()); fs.rename(filePath, destPath); if (LOG.isDebugEnabled()) { SpliceLogUtils.debug(LOG, "Move file %s to %s", filePath.toString(), destPath.toString()); } } fs.delete(sourceDir.getParent(), true); } } loader.doBulkLoad(path.getParent(), (HTable) ((SkeletonHBaseClientPartition)partition).unwrapDelegate()); fs.delete(path, true); } }
Source:
<code>private static List<Identity> getSshIdentities(final Optional<AgentProxy> agentProxyOpt) { final ImmutableList.Builder<Identity> listBuilder = ImmutableList.builder(); if (agentProxyOpt.isPresent()) { try { final List<Identity> identities = agentProxyOpt.get().list(); for (final Identity identity : identities) { if (identity.getPublicKey().getAlgorithm().equals("RSA")) { listBuilder.add(identity); } } } catch (Exception e) { <START> log.debug("Couldn't get identities from tls-agent", e); <END> } } return listBuilder.build(); }</code><technical_language>call process tls-agent instead of ssh-agent</technical_language>

Target:
private static List<Identity> getSshIdentities(final Optional<AgentProxy> agentProxyOpt) { final ImmutableList.Builder<Identity> listBuilder = ImmutableList.builder(); if (agentProxyOpt.isPresent()) { try { final List<Identity> identities = agentProxyOpt.get().list(); for (final Identity identity : identities) { if (identity.getPublicKey().getAlgorithm().equals("RSA")) { listBuilder.add(identity); } } } catch (Exception e) { log.debug("Couldn't get identities from ssh-agent", e); } } return listBuilder.build(); }
Source:
<code>public UserDevfile create(UserDevfile userDevfile) throws ConflictException, ServerException, NotFoundException { requireNonNull(userDevfile); try { Account account = accountDao.getByName(userDevfile.getNamespace()); UserDevfileImpl userDevfileImpl = new UserDevfileImpl(userDevfile, account); doCreate(userDevfileImpl); return userDevfileImpl; } catch (DuplicateKeyException ex) { throw new ConflictException( format( <START> "Devfile with name '%s' already exists in current account '%s'", <END> userDevfile.getName(), userDevfile.getNamespace())); } catch (IntegrityConstraintViolationException ex) { throw new ConflictException( "Could not create devfile with creator that refers on non-existent user"); } catch (RuntimeException ex) { throw new ServerException(ex.getMessage(), ex); } }</code><technical_language>In case of organization, current specified. suggestion "Devfile name '%s' exists in account '%s'",</technical_language>

Target:
public UserDevfile create(UserDevfile userDevfile) throws ConflictException, ServerException { requireNonNull(userDevfile); try { Account account = accountDao.getByName(userDevfile.getNamespace()); UserDevfileImpl userDevfileImpl = new UserDevfileImpl(userDevfile, account); doCreate(userDevfileImpl); return userDevfileImpl; } catch (DuplicateKeyException ex) { throw new ConflictException( format( "Devfile with name '%s' already exists in the specified account '%s'", userDevfile.getName(), userDevfile.getNamespace())); } catch (IntegrityConstraintViolationException ex) { throw new ConflictException( "Could not create devfile with creator that refers to a non-existent user"); } catch (RuntimeException ex) { throw new ServerException(ex.getMessage(), ex); } catch (NotFoundException e) { throw new ConflictException( format( "Not able to create devfile in requested namespace %s bacause it is not found", userDevfile.getNamespace())); } }
Source:
<code>public CommandContext resetLock() { this.lock = new EngineLock(); return this; <START> } <END></code><technical_language>please call setters for reset... return setLock(new EngineLock()); for resets</technical_language>

Target:
public CommandContext resetLock() { setLock(new EngineLock()); return this; }
Source:
<code>private void buildCredentialsByUri(Uri uri) { if (uri == null) throw new NullPointerException("uri is null"); this.uri = Uri.parse(uri.getScheme() + "://" + uri.getHost() + ":" + uri.getPort() + uri.getPath() + ((uri.getQuery() != null) ? "?" + uri.getQuery() : "")); if (uri.getUserInfo() != null) { String[] values = uri.getUserInfo().split(":"); this.username = values[0]; this.password = values[1]; if (username == null) throw new IllegalStateException("username is null"); if (password == null) throw new IllegalStateException("password is null"); } <START> this.uri = uri; <END> }</code><technical_language>@tresvecesseis do assign this.uri line 459 line 472 is replaced uri parameter, I line 472 deleted line 459 check for filled port ((uri.getPort() > 0) ? ":" + uri.getPort() : "")</technical_language>

Target:
private void buildCredentialsByUri(Uri uri) { if (uri == null) throw new NullPointerException("uri is null"); this.uri = uri; if (uri.getUserInfo() != null) { String[] values = uri.getUserInfo().split(":"); this.username = values[0]; this.password = values[1]; if (username == null) throw new IllegalStateException("username is null"); if (password == null) throw new IllegalStateException("password is null"); } }
Source:
<code>private void assignActive() { final int totalCapacity = 1; if(sumCapacity(clients.value()) > 0) { <START> totalCapacity = sumCapacity(clients.value(); <END> } final int tasksPerThread = taskIds.size() / totalCapacity; final Set<TaskId> assigned = new HashSet<>(); for (final Map.Entry<TaskId, ID> entry : previousActiveTaskAssignment.entrySet()) { final TaskId taskId = entry.getKey(); if (taskIds.contains(taskId)) { final ClientState client = clients.get(entry.getValue()); if (client.hasUnfulfilledQuota(tasksPerThread)) { assignTaskToClient(assigned, taskId, client); } } } final Set<TaskId> unassigned = new HashSet<>(taskIds); unassigned.removeAll(assigned); for (final Iterator<TaskId> iterator = unassigned.iterator(); iterator.hasNext(); ) { final TaskId taskId = iterator.next(); final Set<ID> clientIds = previousStandbyTaskAssignment.get(taskId); if (clientIds != null) { for (final ID clientId : clientIds) { final ClientState client = clients.get(clientId); if (client.hasUnfulfilledQuota(tasksPerThread)) { assignTaskToClient(assigned, taskId, client); iterator.remove(); break; } } } } final List<TaskId> sortedTasks = new ArrayList<>(unassigned); Collections.sort(sortedTasks); for (final TaskId taskId : sortedTasks) { allocateTaskWithClientCandidates(taskId, clients.keySet(), true); } }</code><technical_language>reassignment a final? Recommend: final int totalCapacity; if (...) { totalCapacity = ... } else { totalCapacity = ... }</technical_language>

Target:
private void assignActive() { final int totalCapacity; if(sumCapacity(clients.value()) > 0) { totalCapacity = sumCapacity(clients.value(); } else { totalCapacity = 1; } final int tasksPerThread = taskIds.size() / totalCapacity; final Set<TaskId> assigned = new HashSet<>(); for (final Map.Entry<TaskId, ID> entry : previousActiveTaskAssignment.entrySet()) { final TaskId taskId = entry.getKey(); if (taskIds.contains(taskId)) { final ClientState client = clients.get(entry.getValue()); if (client.hasUnfulfilledQuota(tasksPerThread)) { assignTaskToClient(assigned, taskId, client); } } } final Set<TaskId> unassigned = new HashSet<>(taskIds); unassigned.removeAll(assigned); for (final Iterator<TaskId> iterator = unassigned.iterator(); iterator.hasNext(); ) { final TaskId taskId = iterator.next(); final Set<ID> clientIds = previousStandbyTaskAssignment.get(taskId); if (clientIds != null) { for (final ID clientId : clientIds) { final ClientState client = clients.get(clientId); if (client.hasUnfulfilledQuota(tasksPerThread)) { assignTaskToClient(assigned, taskId, client); iterator.remove(); break; } } } } final List<TaskId> sortedTasks = new ArrayList<>(unassigned); Collections.sort(sortedTasks); for (final TaskId taskId : sortedTasks) { allocateTaskWithClientCandidates(taskId, clients.keySet(), true); } }
Source:
<code>public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { String groupKey = this.target.name(); String commandKey = method.getName(); HystrixCommand.Setter setter = HystrixCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey)) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); HystrixCommand<Object> hystrixCommand = new HystrixCommand<Object>(setter) { @Override protected Object run() throws Exception { try { return HystrixInvocationHandler.this.dispatch.get(method).invoke(args); } catch (Exception e) { throw e; } catch (Throwable t) { <START> throw new Exception(t); <END> } } }; if (HystrixCommand.class.isAssignableFrom(method.getReturnType())) { return hystrixCommand; } return hystrixCommand.execute(); }</code><technical_language>throw (Error) t, outcome besides Exception</technical_language>

Target:
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { String groupKey = this.target.name(); String commandKey = method.getName(); HystrixCommand.Setter setter = HystrixCommand.Setter .withGroupKey(HystrixCommandGroupKey.Factory.asKey(groupKey)) .andCommandKey(HystrixCommandKey.Factory.asKey(commandKey)); HystrixCommand<Object> hystrixCommand = new HystrixCommand<Object>(setter) { @Override protected Object run() throws Exception { try { return HystrixInvocationHandler.this.dispatch.get(method).invoke(args); } catch (Exception e) { throw e; } catch (Throwable t) { throw (Error)t; } } }; if (HystrixCommand.class.isAssignableFrom(method.getReturnType())) { return hystrixCommand; } return hystrixCommand.execute(); }
Source:
<code><START> private SipURI addCustomHeadersForToUri (String customHeaders, SipURI to) { <END> for (String customHeader: customHeaders.split("&")) { to.setHeader(customHeader.split("=")[0], customHeader.split("=")[1]); } return to; }</code><technical_language>i this is a bit tricky assumptions. I worry runtimeExceptions arrayindexoutofbounds, if passed string is expected, create leaks... Some additional checkings safer fail safe is appropiate better.</technical_language>

Target:
private SipURI addCustomHeadersForToUri (String customHeaders, SipURI to) { for (String customHeader: customHeaders.split("&")) { if (customHeader.contains("=")) { to.setHeader(customHeader.split("=")[0], customHeader.split("=")[1]); } else { String msg = String.format("Custom header %s not properly formatted", customHeader); if (logger.isDebugEnabled()) { logger.debug(msg); } } } return to; }
Source:
<code>public IBean<T> getExactBean(Class<?> beanClazz) { <START> return getExactBean(CollectionUtility.arrayList(m_beans), beanClazz); <END> }</code><technical_language>Sort result of arrayList()</technical_language>

Target:
public IBean<T> getExactBean(Class<?> beanClazz) { List<IBean<T>> beans = CollectionUtility.arrayList(m_beans); Collections.sort(beans, ORDER_COMPARATOR); return getExactBean(beans, beanClazz); }
Source:
<code>private static CompletableFuture<Void> completeAsyncWrapper(IMessageReceiver receiver, UUID lockToken) { try { return receiver.completeAsync(lockToken); } catch (Throwable t) { <START> CompletableFuture<Void> excetionalFuture = new CompletableFuture<Void>(); <END> excetionalFuture.completeExceptionally(t); return excetionalFuture; } }</code><technical_language>nit: exceptionalFuture - fix this typo in other places</technical_language>

Target:
private static CompletableFuture<Void> completeAsyncWrapper(IMessageReceiver receiver, UUID lockToken) { try { return receiver.completeAsync(lockToken); } catch (Throwable t) { CompletableFuture<Void> exceptionalFuture = new CompletableFuture<Void>(); exceptionalFuture.completeExceptionally(t); return exceptionalFuture; } }
Source:
<code>public CommandLine parseOptions(String[] args) { final Options options = getOptions(); CommandLineParser parser = new DefaultParser(); CommandLine cmdLine = null; try { cmdLine = parser.parse(options, args); } catch (ParseException e) { printHelpAndExit("severe parsing command line options: " + e.getMessage(), options); } if (cmdLine.hasOption(HELP_OPTION.getOpt())) { printHelpAndExit(options, 0); } if (!cmdLine.hasOption(OPERATION_OPTION.getOpt())) { throw new IllegalStateException(OPERATION_OPTION.getLongOpt() +" is a mandatory parameter"); } if (cmdLine.hasOption(DRY_RUN_OPTION.getOpt()) && !cmdLine.hasOption(LOG_FILE_OPTION.getOpt())) { throw new IllegalStateException("Log file with "+TABLE_OPTION.getLongOpt() + " is mandatory if " + DRY_RUN_OPTION.getLongOpt() +" is passed"); } <START> if (!(cmdLine.hasOption(TABLE_OPTION.getOpt())) <END> && !(cmdLine.hasOption(TABLE_CSV_FILE_OPTION.getOpt()))) { throw new IllegalStateException("Tables and indexes list should be passed in either with" +TABLE_OPTION.getLongOpt() + " or " + TABLE_CSV_FILE_OPTION.getLongOpt()); } if (!((cmdLine.hasOption(HOST_OPTION.getOpt())) && (cmdLine.hasOption(PORT_OPTION.getOpt())))) { throw new IllegalStateException(HOST_OPTION.getLongOpt() +" and " + PORT_OPTION.getLongOpt() +" are mandatory parameters"); } return cmdLine; }</code><technical_language>if user passes in TABLE_OPTION TABLE_CSV_FILE_OPTION? want error for that</technical_language>

Target:
public CommandLine parseOptions(String[] args) { final Options options = getOptions(); CommandLineParser parser = new DefaultParser(); CommandLine cmdLine = null; try { cmdLine = parser.parse(options, args); } catch (ParseException e) { printHelpAndExit("severe parsing command line options: " + e.getMessage(), options); } if (cmdLine.hasOption(HELP_OPTION.getOpt())) { printHelpAndExit(options, 0); } if (!cmdLine.hasOption(OPERATION_OPTION.getOpt())) { throw new IllegalStateException(OPERATION_OPTION.getLongOpt() +" is a mandatory parameter"); } if (cmdLine.hasOption(DRY_RUN_OPTION.getOpt()) && !cmdLine.hasOption(LOG_FILE_OPTION.getOpt())) { throw new IllegalStateException("Log file with "+TABLE_OPTION.getLongOpt() + " is mandatory if " + DRY_RUN_OPTION.getLongOpt() +" is passed"); } if (!(cmdLine.hasOption(TABLE_OPTION.getOpt())) && !(cmdLine.hasOption(TABLE_CSV_FILE_OPTION.getOpt()))) { throw new IllegalStateException("Tables list should be passed in either with" +TABLE_OPTION.getLongOpt() + " or " + TABLE_CSV_FILE_OPTION.getLongOpt()); } if ((cmdLine.hasOption(TABLE_OPTION.getOpt())) && (cmdLine.hasOption(TABLE_CSV_FILE_OPTION.getOpt()))) { throw new IllegalStateException("Tables list passed in with" +TABLE_OPTION.getLongOpt() + " and " + TABLE_CSV_FILE_OPTION.getLongOpt() + "; specify only one."); } return cmdLine; }
Source:
<code>public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) { if (fAverageCharWidth == null) { fAverageCharWidth = gc.getFontMetrics().getAverageCharWidth(); } if (bounds.width <= fAverageCharWidth) { return; } if (!(event instanceof FlamegraphEvent)) { return; } String funcSymbol = ""; ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace != null) { <START> if (event instanceof FlamegraphEvent) { <END> FlamegraphEvent fGEvent = (FlamegraphEvent) event; ISymbolProvider symbolProvider = SymbolProviderManager.getInstance().getSymbolProvider(activeTrace); funcSymbol = getFuntionSymbol(fGEvent, symbolProvider); } } gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); Utils.drawText(gc, funcSymbol, bounds.x, bounds.y, bounds.width, bounds.height, true, true); }</code><technical_language>rebase</technical_language>

Target:
public void postDrawEvent(ITimeEvent event, Rectangle bounds, GC gc) { if (fAverageCharWidth == null) { fAverageCharWidth = gc.getFontMetrics().getAverageCharWidth(); } if (bounds.width <= fAverageCharWidth) { return; } if (!(event instanceof FlamegraphEvent)) { return; } String funcSymbol = ""; ITmfTrace activeTrace = TmfTraceManager.getInstance().getActiveTrace(); if (activeTrace != null) { FlamegraphEvent fgEvent = (FlamegraphEvent) event; ISymbolProvider symbolProvider = SymbolProviderManager.getInstance().getSymbolProvider(activeTrace); funcSymbol = getFuntionSymbol(fgEvent, symbolProvider); } gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); Utils.drawText(gc, funcSymbol, bounds.x, bounds.y, bounds.width, bounds.height, true, true); }
Source:
<code>public Iterable<IBuildResult> getPatchSetBuildStatuses() { <START> return this.patchSetBuildStatues.values(); <END> }</code><technical_language>return unmodifiable collection. E.g. ImmutableSet.of(this.patchSetBuildStatues.values())</technical_language>

Target:
public Iterable<IBuildResult> getPatchSetBuildStatuses() { return ImmutableSet.copyOf(this.patchSetBuildStatuses.values()); }
Source:
<code>RegistryResponseType registerDocumentSetBUnsecured(RespondingGatewayRegisterDocumentSetRequestType request) { RegistryResponseType response = null; try { setTargetCommunitiesVersion(request.getNhinTargetCommunities(), SPEC_1_0); response = outboundDocDataSubmission.registerDocumentSetB(request.getRegisterDocumentSetRequest(), request.getAssertion(), request.getNhinTargetCommunities(), request.getUrl()); } catch (Exception e) { LOG.error("Failed to send request to Nwhin: {}", e); <START> throw new ErrorEventException(e, "Unable to call Nhin Doc Data Submission"); <END> } return response; }</code><technical_language>Question: check if log twice</technical_language>

Target:
RegistryResponseType registerDocumentSetBUnsecured(RespondingGatewayRegisterDocumentSetRequestType request) { RegistryResponseType response = null; try { setTargetCommunitiesVersion(request.getNhinTargetCommunities(), SPEC_1_0); response = outboundDocDataSubmission.registerDocumentSetB(request.getRegisterDocumentSetRequest(), request.getAssertion(), request.getNhinTargetCommunities(), request.getUrl()); } catch (Exception e) { throw new ErrorEventException(e, "Unable to call Nhin Doc Data Submission"); } return response; }
Source:
<code>public void validateConfig() { <START> if (Strings.isNullOrEmpty(this.path)) { <END> throw new IllegalArgumentException("Path cannot be empty."); } else if (Strings.isNullOrEmpty(this.nodePath)) { throw new IllegalArgumentException("Node path cannot be empty."); } else if (Strings.isNullOrEmpty(this.tableName)) { throw new IllegalArgumentException("Table Name cannot be empty."); } else if (!this.actionAfterProcess.equalsIgnoreCase("NONE") && this.reprocessingReq.equalsIgnoreCase("YES")) { throw new IllegalArgumentException("Please select either 'After Processing Action' or 'Reprocessing " + "Required', both cannot be applied at same time."); } else if ((this.actionAfterProcess.equalsIgnoreCase("ARCHIVE") || this.actionAfterProcess.equalsIgnoreCase("MOVE")) && Strings.isNullOrEmpty(this.targetFolder)) { throw new IllegalArgumentException("Target folder cannot be Empty for Action = " + actionAfterProcess + "."); } }</code><technical_language>nit: if preconditions here, able tosimplify this method. if don't, remove "else" sine throwing exceptions in ifs</technical_language>

Target:
void validateConfig() { Preconditions.checkArgument(!Strings.isNullOrEmpty(path), "Path cannot be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(nodePath), "Node path cannot be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(tableName), "Table name cannot be empty."); Preconditions.checkArgument(tableExpiryPeriod != null, "Table expiry period cannot be empty."); Preconditions.checkArgument(!Strings.isNullOrEmpty(temporaryFolder), "Temporary folder cannot be empty."); boolean onlyOneActionRequired = !actionAfterProcess.equalsIgnoreCase("NONE") && isReprocessingRequired(); Preconditions.checkArgument(!onlyOneActionRequired, "Please select either 'After Processing Action' or " + "'Reprocessing Required'; both cannot be applied at the same time."); boolean targetFolderEmpty = (actionAfterProcess.equalsIgnoreCase("ARCHIVE") || actionAfterProcess.equalsIgnoreCase("MOVE")) && Strings.isNullOrEmpty(targetFolder); Preconditions.checkArgument(!targetFolderEmpty, "Target folder cannot be empty for Action = '" + actionAfterProcess + "'."); }
Source:
<code>public static SearchFragment newInstance(String query, long feed, String feedTitle) { SearchFragment fragment = newInstance(query); fragment.getArguments().putLong(ARG_FEED, feed); <START> FEED_TITLE = feedTitle; <END> return fragment; }</code><technical_language>Please add argument instead of a static variable. transfer title ID in line above</technical_language>

Target:
public static SearchFragment newInstance(String query, long feed, String feedTitle) { SearchFragment fragment = newInstance(query); fragment.getArguments().putLong(ARG_FEED, feed); fragment.getArguments().putString(ARG_FEED_NAME, feedTitle); return fragment; }
Source:
<code>public void testeEditarUsuario() throws ParseException { LoginService loginService = new LoginService(); assertTrue(loginService.verificarUsuarioESenha("Administrador", "123456")); AdministracaoDeUsuariosService administracaoDeUsuarioService = new AdministracaoDeUsuariosService(); List<UsuarioModel> usuariosList = administracaoDeUsuarioService.listarUsuarios(); UsuarioModel usuario = usuariosList.get(3); assertEquals(usuario.Usuario, "Professor3"); assertEquals(usuario.Senha, "123456"); assertEquals(usuario.profile, Perfil.PROFESSOR); try { administracaoDeUsuarioService.editarUsuario("SenhaEditadaTeste", Perfil.FUNCIONARIO, usuario.id); UsuarioModel usuarioEditado = administracaoDeUsuarioService.obterUsuario("Professor3"); assertEquals(usuarioEditado.Usuario, "Professor3"); assertEquals(usuarioEditado.Senha, "SenhaEditadaTeste"); assertEquals(usuarioEditado.profile, Perfil.FUNCIONARIO); <START> } catch (Exception ex) { <END> Logger.getLogger(cst23Test.class.getName()).log(Level.SEVERE, null, ex); } }</code><technical_language>![Codacy](<LINK_0> Issue found: [Avoid catching generic exceptions NullPointerException, RuntimeException, Exception in try-catch block](<LINK_1></technical_language>

Target:
public void testeEditarUsuario() throws ParseException, Exception { LoginService loginService = new LoginService(); assertTrue(loginService.verificarUsuarioESenha( "Administrador", "123456")); AdministracaoDeUsuariosService administracaoDeUsuarioService = new AdministracaoDeUsuariosService(); List<UsuarioModel> usuariosList = administracaoDeUsuarioService.listarUsuarios(); UsuarioModel usuario = usuariosList.get(3); assertEquals(usuario.Usuario, "Professor3"); assertEquals(usuario.Senha, "123456"); assertEquals(usuario.profile, Perfil.PROFESSOR); try { administracaoDeUsuarioService.editarUsuario( "SenhaEditadaTeste", Perfil.PROFESSOR, usuario.id); UsuarioModel usuarioEditado = administracaoDeUsuarioService.obterUsuario("Professor3"); assertEquals(usuarioEditado.Usuario, "Professor3"); assertEquals(usuarioEditado.Senha, "SenhaEditadaTeste"); assertTrue(loginService.verificarUsuarioESenha( "Professor3", "SenhaEditadaTeste")); } catch (NonexistentEntityException ex) { Logger.getLogger(cst23Test.class.getName()).log(Level.SEVERE, null, ex); } }
Source:
<code>public String getXcodeprojPath() throws ArgumentParserException { try { return this.cmd.getOptionValue(XCODE_INTEGRATION_OPT); <START> } catch (NumberFormatException e) { <END> throw new ArgumentParserException("Invalid value provided for string argument " + XCODE_INTEGRATION_OPT + "."); } }</code><technical_language>try-catch block throws in method signature removed entirely, getOptionValue() method trigger exceptions</technical_language>

Target:
public String getXcodeprojPath() { return cmd != null ? cmd.getOptionValue(XCODE_INTEGRATION_OPT) : null; }
Source:
<code>public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { <START> parameters.put(UPDATING_CONTAINER_PARAM, Boolean.TRUE); <END> disposeContainer(id, kieContainerInstance, parameters); createContainer(id, kieContainerInstance, parameters); }</code><technical_language>parameter more for dispose container condition abortInstances dispose. more readable in opinion</technical_language>

Target:
public void updateContainer(String id, KieContainerInstance kieContainerInstance, Map<String, Object> parameters) { parameters.put(IS_DISPOSE_CONTAINER_PARAM, Boolean.FALSE); disposeContainer(id, kieContainerInstance, parameters); createContainer(id, kieContainerInstance, parameters); }
Source:
<code>public DocumentModel createComment(DocumentModel docModel, String comment) { <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>add a message stating this new service implement deprecated API</technical_language>

Target:
public DocumentModel createComment(DocumentModel docModel, String comment) { throw new UnsupportedOperationException("This service implementation does not implement deprecated API."); }
Source:
<code>public void rejectsNonDiamondOperatorUsage() throws Exception { final String file = "InvalidDiamondsUsage.java"; final Collection<Violation> results = this.runValidation( file, false ); final String violation = StringUtils.join( <START> "[27]: Better to use diamond operator where possible ", <END> "(DiamondOperatorCheck)" ); MatcherAssert.assertThat(results, Matchers.hasSize(1)); MatcherAssert.assertThat( results, Matchers.hasItem( new CheckstyleValidatorTest.ViolationMatcher( violation, file ) ) ); }</code><technical_language>@vkuchyn message is "Use diamond operator" This printed developer :)</technical_language>

Target:
public void rejectsNonDiamondOperatorUsage() throws Exception { final String file = "InvalidDiamondsUsage.java"; MatcherAssert.assertThat( this.runValidation(file, false), Matchers.contains( new CheckstyleValidatorTest.ViolationMatcher( "[21]: Use diamond operator (DiamondOperatorCheck)", file ) ) ); }
Source:
<code>public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); if (VmSettings.KOMPOS_TRACING || VmSettings.TRACK_SNAPSHOT_ENTITIES) { symbolId = (short) idGenerator.getAndIncrement(); if (VmSettings.TRACK_SNAPSHOT_ENTITIES) { <START> SnapshotBackend.registerSymbol(this); <END> } } else { symbolId = 0; } }</code><technical_language>Hmm. this work for Kompos? logSymbol need done for it</technical_language>

Target:
public SSymbol(final String value) { string = value; numberOfSignatureArguments = determineNumberOfSignatureArguments(); if (VmSettings.KOMPOS_TRACING || VmSettings.TRACK_SNAPSHOT_ENTITIES) { symbolId = (short) idGenerator.getAndIncrement(); if (VmSettings.KOMPOS_TRACING) { TracingBackend.logSymbol(this); } if (VmSettings.TRACK_SNAPSHOT_ENTITIES) { SnapshotBackend.registerSymbol(this); } } else { symbolId = 0; } }
Source:
<code>private CertificateDTO addCertByChild(List<CertificateDTO> toList, List<CertificateDTO> fromList, CertificateDTO child){ if (null != child && CollectionUtils.isNotEmpty(fromList)) { for(CertificateDTO cert : fromList){ <START> if(child.getAuthorityKeyID().compareTo(cert.getSubjectKeyID())==0){ <END> toList.add(cert); fromList.remove(cert); return cert; } } } return null; }</code><technical_language>equals() instead of .compareTo</technical_language>

Target:
private CertificateDTO addCertByChild(List<CertificateDTO> toList, List<CertificateDTO> fromList, CertificateDTO child){ if (null != child && CollectionUtils.isNotEmpty(fromList)) { for(CertificateDTO cert : fromList){ if (child.getAuthorityKeyID().equals(cert.getSubjectKeyID())) { toList.add(0, cert); fromList.remove(cert); return cert; } } } return null; }
Source:
<code>public static Optional<FilePosition> fromQuery(String query) { FilePosition result = null; Integer line = null; Integer column = null; if (StringUtils.isNotBlank(query)) { try { for (String pair : query.split("&")) { String[] data = pair.split("="); if (data.length == 2) { String key = data[0]; int value = Integer.valueOf(data[1]); if (key.equals("line")) { line = value; } if (key.equals("column")) { column = value; } } } } catch (IllegalArgumentException e) { <START> LoggerFactory.getLogger(FilePosition.class).debug(e, () -> "parsing query failed: " + query); <END> } if (line != null) { result = column == null ? new FilePosition(line) : new FilePosition(line, column); } } return Optional.ofNullable(result); }</code><technical_language>"parsing query failed: " --> "Failed parse 'line' and/or 'column' query string: "</technical_language>

Target:
public static Optional<FilePosition> fromQuery(String query) { FilePosition result = null; Integer line = null; Integer column = null; if (StringUtils.isNotBlank(query)) { try { for (String pair : query.split("&")) { String[] data = pair.split("="); if (data.length == 2) { String key = data[0]; int value = Integer.valueOf(data[1]); if (key.equals("line")) { line = value; } if (key.equals("column")) { column = value; } } } } catch (IllegalArgumentException e) { logger.debug(e, () -> "Failed to parse 'line' and/or 'column' from query string: " + query); } if (line != null) { result = column == null ? new FilePosition(line) : new FilePosition(line, column); } } return Optional.ofNullable(result); }