auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static HistoryPageInput getMostFittingInput( @NonNull IStructuredSelection selection, Object mandatoryObject) { Set<IResource> resources = getSelectedResourcesSet(selection); if (!resources.contains(mandatoryObject)) { return null; } Repository repository = getRepository((IResource) mandatoryObject); if (repository == null) { return null; } for (Iterator<IResource> it = resources.iterator(); it.hasNext();) { IResource resource = it.next(); if (getRepository(resource) != repository) { it.remove(); } } IResource[] resourceArray = resources.toArray(new IResource[resources .size()]); return new HistoryPageInput(repository, resourceArray); }

Target:
public static HistoryPageInput getMostFittingInput( @NonNull IStructuredSelection selection, Object mandatoryObject) { Set<IResource> resources = getSelectedResourcesSet(selection); if (!resources.contains(mandatoryObject)) { return null; } Repository repository = ResourceUtil .getRepository((IResource) mandatoryObject); if (repository == null) { return null; } for (Iterator<IResource> it = resources.iterator(); it.hasNext();) { IResource resource = it.next(); if (ResourceUtil.getRepository(resource) != repository) { it.remove(); } } IResource[] resourceArray = resources.toArray(new IResource[resources .size()]); return new HistoryPageInput(repository, resourceArray); }
Source:
private void loadPathNames() { pathToName = null; if (modulesConfig != null) { HashMap<String, String> pathNames = new HashMap<>(modulesConfig .getSubsections(ConfigConstants.CONFIG_SUBMODULE_SECTION) .size()); for (String name : modulesConfig .getSubsections(ConfigConstants.CONFIG_SUBMODULE_SECTION)) { pathNames.put(modulesConfig.getString( ConfigConstants.CONFIG_SUBMODULE_SECTION, name, ConfigConstants.CONFIG_KEY_PATH), name); } pathToName = pathNames; } }

Target:
private void loadPathNames() { pathToName = null; if (modulesConfig != null) { HashMap<String, String> pathNames = new HashMap<>(); for (String name : modulesConfig .getSubsections(ConfigConstants.CONFIG_SUBMODULE_SECTION)) { pathNames.put(modulesConfig.getString( ConfigConstants.CONFIG_SUBMODULE_SECTION, name, ConfigConstants.CONFIG_KEY_PATH), name); } pathToName = pathNames; } }
Source:
public void likePost(Long postId, String likerUsername) { Post likedPost = postRepository.findOne(postId); if (likedPost == null) { throw new PostNotFoundException(postId); } User user = userService.findUserByUsername(likerUsername).get(); if (likedPost.isNotAlreadyLikedBy(likerUsername)) { likedPost.addLike(user); postRepository.save(likedPost); LikePostEvent likePostEvent = new LikePostEvent(likedPost, likerUsername); if(!likedPost.isOwnedBy(likerUsername)) { domainEvents.raise(likePostEvent); } } }

Target:
public void likePost(Long postId, String likerUsername) { Post post = postRepository.findOne(postId); if (post == null) { throw new PostNotFoundException(postId); } User user = userService.findUserByUsername(likerUsername).get(); if (post.isNotAlreadyLikedBy(likerUsername)) { post.addLike(user); postRepository.save(post); LikePostEvent likePostEvent = new LikePostEvent(post, likerUsername); domainEvents.raise(likePostEvent); } }
Source:
public void readUpdatedMetadataValue() throws Exception { GraphDatabaseFacade localGraph = neo.getLocalGraph(); try ( Transaction transaction = localGraph.beginTx() ) { String testValue = "testValue"; String testKey = "test"; localGraph.execute( "CALL dbms.setTXMetaData", map( "data", map( testKey, testValue ) ) ); Map<String,Object> metadata = (Map<String,Object>) localGraph.execute( "CALL dbms.getTXMetaData " ).next().get( "metadata" ); assertEquals( testValue, metadata.get( testKey ) ); } }

Target:
public void readUpdatedMetadataValue() throws Throwable { String testValue = "testValue"; String testKey = "test"; GraphDatabaseFacade graph = neo.getLocalGraph(); try ( InternalTransaction transaction = neo.beginLocalTransactionAsUser( writeSubject, KernelTransaction.Type.explicit ) ) { graph.execute( "CALL dbms.setTXMetaData({" + testKey + ":'" + testValue + "'})" ); Map<String,Object> metadata = (Map<String,Object>) graph.execute( "CALL dbms.getTXMetaData " ).next().get( "metadata" ); assertEquals( testValue, metadata.get( testKey ) ); } }
Source:
public boolean equals(Object o) { new RuntimeException("partitioningHandle equals").printStackTrace(); if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } HivePartitionHandle that = (HivePartitionHandle) o; return bucket == that.bucket; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } HivePartitionHandle that = (HivePartitionHandle) o; return bucket == that.bucket; }
Source:
public void testAttachmentWithUnicode() throws Exception { String osName = System.getProperty("os.name").toLowerCase(); if (!osName.startsWith("mac os x")) { testAttachmentWithSpecialCharacters( "\u00E7\u00F1\u00A5\u20AC\u00A3\u00BD\u00BC\u03B2\u03B8\u53F0\u5317\u3096\u3097\uFF73"); } }

Target:
public void testAttachmentWithUnicode() throws Exception { String osName = System.getProperty("os.name").toLowerCase(); assumeTrue(!osName.startsWith("mac os x")); testAttachmentWithSpecialCharacters( "\u00E7\u00F1\u00A5\u20AC\u00A3\u00BD\u00BC\u03B2\u03B8\u53F0\u5317\u3096\u3097\uFF73"); }
Source:
public DayOfWeekConditionHandler(Condition module) { super(module); try { days = new ArrayList<>(); for (String day : (Iterable<String>) module.getConfiguration().get(CFG_DAYS)) { switch (day) { case "SUN": days.add(1); break; case "MON": days.add(2); break; case "TUE": days.add(3); break; case "WED": days.add(4); break; case "THU": days.add(5); break; case "FRI": days.add(6); break; case "SAT": days.add(7); break; } } days.toArray(new Integer[days.size()]); } catch (Exception e) { throw new IllegalArgumentException("'days' parameter must be an array of strings."); } }

Target:
public DayOfWeekConditionHandler(Condition module) { super(module); try { days = new HashSet<>(); for (String day : (Iterable<String>) module.getConfiguration().get(CFG_DAYS)) { switch (day.toUpperCase()) { case "SUN": days.add(Calendar.SUNDAY); break; case "MON": days.add(Calendar.MONDAY); break; case "TUE": days.add(Calendar.TUESDAY); break; case "WED": days.add(Calendar.WEDNESDAY); break; case "THU": days.add(Calendar.THURSDAY); break; case "FRI": days.add(Calendar.FRIDAY); break; case "SAT": days.add(Calendar.SATURDAY); break; default: logger.warn("Ignoring illegal weekday '{}'", day); break; } } } catch (RuntimeException e) { throw new IllegalArgumentException("'days' parameter must be an array of strings."); } }
Source:
public RaptorSessionProperties(StorageManagerConfig config) { sessionProperties = ImmutableList.of( stringProperty( EXTERNAL_BATCH_ID, "Two-phase commit batch ID", null, true), dataSizeSessionProperty( READER_MAX_MERGE_DISTANCE, "Reader: Maximum size of gap between two reads to merge into a single read", config.getOrcMaxMergeDistance(), false), dataSizeSessionProperty( READER_MAX_READ_SIZE, "Reader: Maximum size of a single read", config.getOrcMaxReadSize(), false), dataSizeSessionProperty( READER_STREAM_BUFFER_SIZE, "Reader: Size of buffer for streaming reads", config.getOrcStreamBufferSize(), false), dataSizeSessionProperty( READER_TINY_STRIPE_THRESHOLD, "Reader: Threshold below which an ORC stripe or file will read in its entirety", config.getOrcTinyStripeThreshold(), false), booleanProperty( READER_LAZY_READ_SMALL_RANGES, "Experimental: Reader: Read small file segments lazily", config.isOrcLazyReadSmallRanges(), false), integerProperty( ONE_SPLIT_PER_BUCKET_THRESHOLD, "Experimental: Maximum bucket count at which to produce multiple splits per bucket", config.getOneSplitPerBucketThreshold(), false), booleanProperty( ORC_ZSTD_JNI_DECOMPRESSION_ENABLED, "use JNI based std decompression for reading ORC files", config.isZstdJniDecompressionEnabled(), true), dataSizeSessionProperty( WRITER_MAX_BUFFER_SIZE, "Raptor page writer max buffer size", config.getMaxBufferSize(), false)); }

Target:
public RaptorSessionProperties(StorageManagerConfig config) { sessionProperties = ImmutableList.of( stringProperty( EXTERNAL_BATCH_ID, "Two-phase commit batch ID", null, true), dataSizeSessionProperty( READER_MAX_MERGE_DISTANCE, "Reader: Maximum size of gap between two reads to merge into a single read", config.getOrcMaxMergeDistance(), false), dataSizeSessionProperty( READER_MAX_READ_SIZE, "Reader: Maximum size of a single read", config.getOrcMaxReadSize(), false), dataSizeSessionProperty( READER_STREAM_BUFFER_SIZE, "Reader: Size of buffer for streaming reads", config.getOrcStreamBufferSize(), false), dataSizeSessionProperty( READER_TINY_STRIPE_THRESHOLD, "Reader: Threshold below which an ORC stripe or file will read in its entirety", config.getOrcTinyStripeThreshold(), false), booleanProperty( READER_LAZY_READ_SMALL_RANGES, "Experimental: Reader: Read small file segments lazily", config.isOrcLazyReadSmallRanges(), false), integerProperty( ONE_SPLIT_PER_BUCKET_THRESHOLD, "Experimental: Maximum bucket count at which to produce multiple splits per bucket", config.getOneSplitPerBucketThreshold(), false), booleanProperty( ORC_ZSTD_JNI_DECOMPRESSION_ENABLED, "use JNI based std decompression for reading ORC files", config.isZstdJniDecompressionEnabled(), true), dataSizeSessionProperty( WRITER_MAX_BUFFER_SIZE, "Raptor page writer max logical buffer size", config.getMaxBufferSize(), false)); }
Source:
protected int rwInEqualsInitializer(IASTEqualsInitializer parent, int indirection) { IASTNode grand = parent.getParent(); if (grand instanceof IASTDeclarator) { IBinding binding = ((IASTDeclarator) grand).getName().getBinding(); if (binding instanceof IVariable) { return rwAssignmentToType(((IVariable) binding).getType(), indirection); } } else if (grand instanceof ICPPASTStructuredBindingDeclaration) { return rwInStructuredBinding((ICPPASTStructuredBindingDeclaration) grand); } else if (grand instanceof IASTReturnStatement) { return READ; } return READ | WRITE; }

Target:
protected int rwInEqualsInitializer(IASTEqualsInitializer parent, int indirection) { IASTNode grand = parent.getParent(); if (grand instanceof IASTDeclarator) { IBinding binding = ((IASTDeclarator) grand).getName().getBinding(); if (binding instanceof IVariable) { return rwAssignmentToType(((IVariable) binding).getType(), indirection); } } else if (grand instanceof ICPPASTStructuredBindingDeclaration) { return rwInStructuredBinding((ICPPASTStructuredBindingDeclaration) grand); } return READ | WRITE; }
Source:
private static void fileExists(String baseDir, String fileName) throws ValidationException { File file = new File(baseDir, fileName); if (!file.exists()) { throw new ValidationException(format("The file %s should be present.", fileName)); } }

Target:
private void fileExists(String baseDir, String fileName) throws ValidationException { File file = new File(baseDir, fileName); if (!file.exists()) { throw new ValidationException(format("The file %s should be present.", fileName)); } }
Source:
public void testEncoded() { SonarQubeServer.Builder builder = SonarQubeServer.newBuilder() .setPassword("pass") .setToken("token"); String encodedPass = builder.getEncodedPassword(); String encodedToken = builder.getEncodedToken(); builder.setEncodedPassword(encodedPass); builder.setEncodedToken(encodedToken); assertThat(builder.getEncodedPassword()).isEqualTo(encodedPass); assertThat(builder.getEncodedToken()).isEqualTo(encodedToken); assertThat(builder.getPassword()).isEqualTo("pass"); assertThat(builder.getToken()).isEqualTo("token"); }

Target:
public void testEncoded() { SonarQubeServer.Builder builder = SonarQubeServer.newBuilder() .setPassword("pass") .setToken("token"); String encodedPass = builder.build().getEncodedPassword(); String encodedToken = builder.build().getEncodedToken(); builder.setEncodedPassword(encodedPass); builder.setEncodedToken(encodedToken); assertThat(builder.build().getEncodedPassword()).isEqualTo(encodedPass); assertThat(builder.build().getEncodedToken()).isEqualTo(encodedToken); assertThat(builder.build().getPassword()).isEqualTo("pass"); assertThat(builder.build().getToken()).isEqualTo("token"); }
Source:
public void testQueryElementPrecedingSiblingVariableDef() throws Exception { final String xpath = " + "VARIABLE_DEF"; final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); final DetailAST expectedVariableDefNode1 = getSiblingByType(rootNode.getUnderlyingNode(), TokenTypes.CLASS_DEF) .findFirstToken(TokenTypes.OBJBLOCK) .findFirstToken(TokenTypes.METHOD_DEF) .findFirstToken(TokenTypes.SLIST) .findFirstToken(TokenTypes.VARIABLE_DEF); final DetailAST expectedVariableDefNode2 = expectedVariableDefNode1.getNextSibling() .getNextSibling(); final DetailAST[] expected = {expectedVariableDefNode2, expectedVariableDefNode1}; assertArrayEquals("Result nodes differ from expected", expected, actual); }

Target:
public void testQueryElementPrecedingSiblingVariableDef() throws Exception { final String xpath = " + "VARIABLE_DEF"; final RootNode rootNode = getRootNode("InputXpathMapperAst.java"); final DetailAST[] actual = convertToArray(getXpathItems(xpath, rootNode)); final DetailAST expectedVariableDefNode1 = getSiblingByType(rootNode.getUnderlyingNode(), TokenTypes.CLASS_DEF) .findFirstToken(TokenTypes.OBJBLOCK) .findFirstToken(TokenTypes.METHOD_DEF) .findFirstToken(TokenTypes.SLIST) .findFirstToken(TokenTypes.VARIABLE_DEF); final DetailAST expectedVariableDefNode2 = expectedVariableDefNode1.getNextSibling() .getNextSibling(); final DetailAST[] expected = {expectedVariableDefNode2, expectedVariableDefNode1}; assertThat("Result nodes differ from expected", actual, equalTo(expected)); }
Source:
public void onEvent(PersistenceProcessorImpl.PersistBatchEvent event) throws Exception { Batch batch = event.getBatch(); handlerBatch = batch; for (int i=0; i < batch.getNumEvents(); ++i) { PersistEvent localEvent = batch.events[i]; switch (localEvent.getType()) { case COMMIT: localEvent.getMonCtx().timerStart("commitPersistProcessor"); writer.addCommittedTransaction(localEvent.getStartTimestamp(), localEvent.getCommitTimestamp()); break; case ABORT: break; case TIMESTAMP: localEvent.getMonCtx().timerStart("timestampPersistProcessor"); break; case LOW_WATERMARK: writer.updateLowWatermark(localEvent.getLowWatermark()); break; default: assert(false); } } flush(event.getBatchID()); }

Target:
public void onEvent(PersistenceProcessorImpl.PersistBatchEvent event) throws Exception { Batch batch = event.getBatch(); for (int i=0; i < batch.getNumEvents(); ++i) { PersistEvent localEvent = batch.getEvent(i); switch (localEvent.getType()) { case COMMIT: localEvent.getMonCtx().timerStart("commitPersistProcessor"); writer.addCommittedTransaction(localEvent.getStartTimestamp(), localEvent.getCommitTimestamp()); break; case ABORT: break; case TIMESTAMP: localEvent.getMonCtx().timerStart("timestampPersistProcessor"); break; case LOW_WATERMARK: writer.updateLowWatermark(localEvent.getLowWatermark()); break; default: assert(false); } } flush(batch, event.getBatchID()); }
Source:
public final Publisher<T> onBackpressureBuffer(long capacity, Action onOverflow, BackpressureOverflowStrategy overflowStrategy) { Objects.requireNonNull(overflowStrategy, "starategy is null"); if (capacity <= 0L) { throw new IllegalArgumentException("capacity > 0 required but it was " + capacity); } return new FlowableOnBackpressureBufferStrategy<T>(this, capacity, onOverflow, overflowStrategy); }

Target:
public final Publisher<T> onBackpressureBuffer(long capacity, Action onOverflow, BackpressureOverflowStrategy overflowStrategy) { Objects.requireNonNull(overflowStrategy, "strategy is null"); verifyPositive(capacity, "capacity"); return new FlowableOnBackpressureBufferStrategy<T>(this, capacity, onOverflow, overflowStrategy); }
Source:
public boolean saveFacultyMemberProfile(FacultyMemberProfile facultyMemberProfile) { Session session = getSession(); beginTransaction(); boolean success = false; try { session.saveOrUpdate(facultyMemberProfile); success = true; } catch (NullPointerException e) { _logger.error("Save FacultyMemberProfile error.", e); } finally { if(success) commitTransaction(); else rollbackTransaction(); } return success; }

Target:
public boolean saveFacultyMemberProfile(FacultyMemberProfile facultyMemberProfile) { Session session = getSession(); beginTransaction(); boolean success = false; try { session.saveOrUpdate(facultyMemberProfile); success = true; } catch (Exception e) { e.printStackTrace(); } finally { if(success) commitTransaction(); else rollbackTransaction(); } return success; }
Source:
public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.F5) { try { for (IRenderer renderer : RendererManager.getCommonRenderers(getSelectedArtifacts(), PresentationType.F5_DIFF)) { for (Artifact art : getSelectedArtifacts()) { if (renderer.getApplicabilityRating(PresentationType.F5_DIFF, art) == IRenderer.SPECIALIZED_KEY_MATCH) { RendererManager.open(art, PresentationType.F5_DIFF); } } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }

Target:
public void keyReleased(KeyEvent e) { if (e.keyCode == SWT.F5) { try { List<Artifact> artifacts = getSelectedArtifacts(); for (IRenderer renderer : RendererManager.getCommonRenderers(artifacts, PresentationType.F5_DIFF)) { for (Artifact art : artifacts) { if (renderer.getApplicabilityRating(PresentationType.F5_DIFF, art) == IRenderer.SPECIALIZED_KEY_MATCH) { RendererManager.open(art, PresentationType.F5_DIFF); } } } } catch (OseeCoreException ex) { OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex); } } }
Source:
public void deleteBlob(String blobIdString) throws CoordinatorException { try { logger.trace("deleteBlob. " + blobIdString); long startTimeInMs = System.currentTimeMillis(); BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, responseFailureHandler, getOperationContext(), blobId, operationTimeoutMs, nodeTimeoutMs); deleteOperation.execute(); notificationSystem.onBlobDeleted(blobIdString); coordinatorMetrics.deleteBlobOperationRate.mark(); coordinatorMetrics.deleteBlobOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } catch (CoordinatorException e) { logger.trace("deleteBlob re-throwing CoordinatorException", e); coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.DeleteBlob, e.getErrorCode()); throw e; } }

Target:
public void deleteBlob(String blobIdString) throws CoordinatorException { try { logger.trace("deleteBlob. " + blobIdString); long startTimeInMs = System.currentTimeMillis(); BlobId blobId = getBlobIdFromString(blobIdString); DeleteOperation deleteOperation = new DeleteOperation(datacenterName, connectionPool, requesterPool, getOperationContext(), blobId, operationTimeoutMs); deleteOperation.execute(); notificationSystem.onBlobDeleted(blobIdString); coordinatorMetrics.deleteBlobOperationRate.mark(); coordinatorMetrics.deleteBlobOperationLatencyInMs.update(System.currentTimeMillis() - startTimeInMs); } catch (CoordinatorException e) { logger.trace("deleteBlob re-throwing CoordinatorException", e); coordinatorMetrics.countError(CoordinatorMetrics.CoordinatorOperationType.DeleteBlob, e.getErrorCode()); throw e; } }
Source:
public Map<String, Object> parse(String input) { try { final Object compiled = fn.apply(input); if (!(compiled instanceof Map)) { throw new ParseException("JavaScript parsed value must in {key: value} format!"); } return (Map) compiled; } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }

Target:
public Map<String, Object> parse(String input) { try { final Object compiled = fn.apply(input); if (!(compiled instanceof Map)) { throw new ParseException("JavaScript parsed value must be in {key: value} format!"); } return (Map) compiled; } catch (Exception e) { throw new ParseException(e, "Unable to parse row [%s]", input); } }
Source:
public void shouldThrowWhenParsingNonNumericNode() throws Exception { exception.expect(JWTDecodeException.class); exception.expectMessage("The claim 'key' contained an unexpected value."); Map<String, JsonNode> tree = new HashMap<>(); TextNode node = new TextNode("123456789"); tree.put("key", node); deserializer.getDateFromSeconds(tree, "key"); }

Target:
public void shouldThrowWhenParsingNonNumericNode() throws Exception { exception.expect(JWTDecodeException.class); exception.expectMessage("The claim 'key' contained a non-numeric date value."); Map<String, JsonNode> tree = new HashMap<>(); TextNode node = new TextNode("123456789"); tree.put("key", node); deserializer.getDateFromSeconds(tree, "key"); }
Source:
public void testManipulateLogger() throws Exception { RestClient client = SERVER_TEST.rest().create(); RestResponse response = sync(client.raw().put("/rest/v2/logging/loggers/org.infinispan.TESTLOGGER?level=WARN&appender=STDOUT")); assertEquals(204, response.getStatus()); response = sync(client.raw().get("/rest/v2/logging/loggers")); assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "WARN", "STDOUT")); response = sync(client.raw().put("/rest/v2/logging/loggers/org.infinispan.TESTLOGGER?level=ERROR&appender=File")); assertEquals(204, response.getStatus()); response = sync(client.raw().get("/rest/v2/logging/loggers")); assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR", "File")); response = sync(client.raw().delete("/rest/v2/logging/loggers/org.infinispan.TESTLOGGER")); assertEquals(204, response.getStatus()); response = sync(client.raw().get("/rest/v2/logging/loggers")); assertFalse("Logger should not be found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR")); }

Target:
public void testManipulateLogger() throws Exception { RestClient client = SERVER_TEST.rest().create(); RestResponse response = sync(client.server().logging().setLogger("org.infinispan.TESTLOGGER", "WARN", "STDOUT")); assertEquals(204, response.getStatus()); response = sync(client.server().logging().listLoggers()); assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "WARN", "STDOUT")); response = sync(client.server().logging().setLogger("org.infinispan.TESTLOGGER", "ERROR", "File")); assertEquals(204, response.getStatus()); response = sync(client.server().logging().listLoggers()); assertTrue("Logger not found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR", "File")); response = sync(client.server().logging().removeLogger("org.infinispan.TESTLOGGER")); assertEquals(204, response.getStatus()); response = sync(client.server().logging().listLoggers()); assertFalse("Logger should not be found", findLogger(response, "org.infinispan.TESTLOGGER", "ERROR")); }
Source:
public Location resolvePlaceLocation(String nameOfLocation) throws InvalidLocationException, LocationDefinitionErrorException { nameOfLocation = nameOfLocation.trim(); if (nameOfLocation.length() == 0) { throw new InvalidLocationException("empty address"); } if (!cache.containsKey(nameOfLocation)) { try { Location result = resolvePlaceLocationGoogle(nameOfLocation); cache.put(nameOfLocation, result); } catch (QueryLimitException e) { try { Location result = resolvePlaceLocationYandex(nameOfLocation); cache.put(nameOfLocation, result); } catch (InvalidLocationException ie) { cache.put(nameOfLocation, null); } } catch (InvalidLocationException e) { cache.put(nameOfLocation, null); } } if (cache.get(nameOfLocation) == null) { throw new InvalidLocationException("Unknown place"); } return cache.get(nameOfLocation); }

Target:
public Location resolvePlaceLocation(String nameOfLocation) throws InvalidLocationException, LocationDefinitionErrorException, MalformedURLException { nameOfLocation = nameOfLocation.trim(); if (nameOfLocation.isEmpty()) { throw new InvalidLocationException("empty address"); } if (!cache.containsKey(nameOfLocation)) { try { Location result = resolvePlaceLocationGoogle(nameOfLocation); cache.put(nameOfLocation, result); } catch (QueryLimitException | LocationDefinitionErrorException e) { System.err.println(e.getMessage()); try { Location result = resolvePlaceLocationYandex(nameOfLocation); cache.put(nameOfLocation, result); } catch (InvalidLocationException ie) { cache.put(nameOfLocation, null); } } catch (InvalidLocationException e) { cache.put(nameOfLocation, null); } } if (cache.get(nameOfLocation) == null) { throw new InvalidLocationException("Unknown place"); } return cache.get(nameOfLocation); }
Source:
public MutableDocumentRevision mutableCopy() { try { BasicDocumentRevision rev = datastore.getDocument(this.getId()); if (rev == null) { return null; } if (!rev.getRevision().equals(this.getRevision())) { return null; } return rev.mutableCopy(); } catch (DocumentNotFoundException e){ logger.log(Level.SEVERE,String.format("Failed to load document %s rom datastore",this.toString()),e); return null; } }

Target:
public MutableDocumentRevision mutableCopy() { try { BasicDocumentRevision rev = datastore.getDocument(this.getId()); if (!rev.getRevision().equals(this.getRevision())) { return null; } return rev.mutableCopy(); } catch (DocumentNotFoundException e){ logger.log(Level.SEVERE,String.format("Failed to load document %s from datastore",this.toString()),e); return null; } }
Source:
@Override public final void registerUser(final School.ItemType collectionType, final String itemId, final String userId, final String registrationKey) throws AuthenticationException { if (authService == null) { authService = Authentication.AuthenticationService.newBlockingStub(getRpcChannel()); } final Authentication.AuthRequest request = Authentication.AuthRequest.newBuilder() .setAuthId(userId) .setItemId(itemId) .setItemType(collectionType) .build(); final Authentication.UserRegistration.Builder creationRequest = Authentication.UserRegistration.newBuilder() .setItemRequest(request); if (registrationKey != null) { creationRequest.setRegistrationKey(registrationKey); } Message.DefaultResponse response = null; try { response = authService.registerUser(getNewRpcController(), creationRequest.build()); if (response.hasException()) { final AuthenticationException authExcep = new AuthenticationException("Exception with authentication server", AuthenticationException.OTHER); authExcep.setProtoException(response.getException()); throw authExcep; } } catch (ServiceException e) { e.printStackTrace(); throw new AuthenticationException(e); } }

Target:
@Override public final void registerUser(final School.ItemType collectionType, final String itemId, final String userId, final String registrationKey) throws AuthenticationException { if (authService == null) { authService = Authentication.AuthenticationService.newBlockingStub(getRpcChannel()); } final Authentication.AuthRequest request = Authentication.AuthRequest.newBuilder() .setAuthId(userId) .setItemId(itemId) .setItemType(collectionType) .build(); final Authentication.UserRegistration.Builder creationRequest = Authentication.UserRegistration.newBuilder() .setItemRequest(request); if (registrationKey != null) { creationRequest.setRegistrationKey(registrationKey); } Message.DefaultResponse response = null; try { response = authService.registerUser(getNewRpcController(), creationRequest.build()); if (response.hasException()) { final AuthenticationException authExcep = new AuthenticationException("Exception with authentication server", AuthenticationException.OTHER); authExcep.setProtoException(response.getException()); throw authExcep; } } catch (ServiceException e) { throw new AuthenticationException(e); } }
Source:
private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { if (dialogButton == confirmButtonType) { if (!issuepickerQueryField.isDisabled()) issuepickerQueryField.appendText(";"); return state.getSelectedIssues().stream().map(TurboIssue::toString).collect(Collectors.toList()); } return null; }); }

Target:
private void createButtons() { ButtonType confirmButtonType = new ButtonType("Confirm", ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(confirmButtonType, ButtonType.CANCEL); setResultConverter(dialogButton -> { Optional<TurboIssue> selectedIssue = state.getSelectedIssue(); if (dialogButton.getButtonData() == ButtonData.OK_DONE && selectedIssue.isPresent()) { return selectedIssue.get().toString(); } return null; }); }
Source:
private static List<String> readLines(InputFile file) { try { return new BufferedReader(new StringReader(file.contents())).lines().collect(Collectors.toList()); } catch (IOException e) { throw new IllegalStateException("Unable to read " + file, e); } }

Target:
private static List<String> readLines(InputFile file) { try (BufferedReader br = new BufferedReader(new StringReader(file.contents()))) { return br.lines().collect(Collectors.toList()); } catch (IOException e) { throw new IllegalStateException("Unable to read " + file, e); } }
Source:
public ContentValuesAssert containsValue(Object expectedValue) { isNotNull(); Set<Map.Entry<String, Object>> entries = actual.valueSet(); List<Object> values = new ArrayList<Object>(entries.size()); for (Map.Entry<String, Object> entry : entries) { values.add(entry.getValue()); } assertThat(values) .overridingErrorMessage("Expected <%s> but was not found", expectedValue.toString()) .contains(expectedValue); return this; }

Target:
public ContentValuesAssert containsValue(Object expectedValue) { isNotNull(); Set<Map.Entry<String, Object>> entries = actual.valueSet(); List<Object> values = new ArrayList<Object>(entries.size()); for (Map.Entry<String, Object> entry : entries) { values.add(entry.getValue()); } assertThat(values) .overridingErrorMessage("Expected <%s> but was not found.", expectedValue) .contains(expectedValue); return this; }
Source:
public EcdhPskServerKeyExchange(ECDHECryptography ecdhe, Random clientRandom, Random serverRandom, int namedCurveId, InetSocketAddress peerAddress) throws GeneralSecurityException { this(namedCurveId, peerAddress); publicKey = ecdhe.getPublicKey(); ECParameterSpec parameters = publicKey.getParams(); point = publicKey.getW(); pointEncoded = ECDHECryptography.encodePoint(point, parameters.getCurve()); }

Target:
public EcdhPskServerKeyExchange(ECDHECryptography ecdhe, Random clientRandom, Random serverRandom, int namedCurveId, InetSocketAddress peerAddress) { this(null, ecdhe, clientRandom, serverRandom, namedCurveId, peerAddress); }
Source:
public void onWebGuiAvailable() { mEventPollerFuture = mScheduledExecutor.scheduleAtFixedRate(new Runnable() { private long mLastEventId = 0; private AsyncState currentState = null; @Override public void run() { if ((currentState == null) || (!currentState.isRunning())) { Log.d(TAG, "Reading events starting with id " + mLastEventId); currentState = mApi.getEvents(mLastEventId, new RestApi.OnReceiveEventListener() { @Override public void onEvent(final long id, final String eventType, final Bundle eventData) { Intent intent = new Intent(); intent.setAction(EVENT_BASE_URL + "." + eventType); intent.replaceExtras(eventData); mContext.sendBroadcast(intent); Log.d(TAG, "Event broadcast for " + eventType); } @Override public void onDone(long id) { if (mLastEventId < id) mLastEventId = id; } }); } } }, EVENT_UPDATE_INTERVAL, EVENT_UPDATE_INTERVAL, TimeUnit.MILLISECONDS); }

Target:
public void onWebGuiAvailable() { Log.d(TAG, "WebGUI available. Starting event processor."); updateFolderMap(); synchronized (mMainThreadHandler) { mShutdown = false; mMainThreadHandler.removeCallbacks(this); mMainThreadHandler.postDelayed(this, EVENT_UPDATE_INTERVAL); } }
Source:
public boolean isEmpty() { return groupEntryCount.get(getGroupId()) == 0; }

Target:
public boolean isEmpty() { return headBlockIndex.get(getGroupId()) == NULL; }
Source:
public Loader<LoaderResult<Document>> onCreateLoader(int id, Bundle args) { Map<String, Serializable> props = new HashMap<String, Serializable>(3); props.put(ContentModel.PROP_DESCRIPTION, args.getString(ARGUMENT_CONTENT_DESCRIPTION)); props.put(ContentModel.PROP_TAGS, args.getStringArrayList(ARGUMENT_CONTENT_TAGS)); props.put(PropertyIds.OBJECT_TYPE_ID, ObjectType.DOCUMENT_BASETYPE_ID); String name = args.getString(ARGUMENT_CONTENT_NAME); ContentFile contentFile = (ContentFile) args.getSerializable(ARGUMENT_CONTENT_FILE); if (contentFile != null && name != null) { currentAccount = SessionUtils.getAccount(getActivity()); Bundle progressBundle = new Bundle(); ContentFile f = (ContentFile) getArguments().getSerializable(ARGUMENT_CONTENT_FILE); if (f.getClass() == ContentFileProgressImpl.class) { ((ContentFileProgressImpl) f).setFilename(name); progressBundle.putString(ProgressNotification.PARAM_DATA_NAME, name); } else { progressBundle.putString(ProgressNotification.PARAM_DATA_NAME, f.getFile().getName()); } progressBundle.putInt(ProgressNotification.PARAM_DATA_SIZE, (int) f.getFile().length()); progressBundle.putInt(ProgressNotification.PARAM_DATA_INCREMENT, (int) (f.getFile().length() / 10)); ProgressNotification.createProgressNotification(getActivity(), progressBundle, getActivity().getClass()); parentFolder = (Folder) getArguments().get(ARGUMENT_FOLDER); } return new DocumentCreateLoader(getActivity(), alfSession, (Folder) getArguments().get(ARGUMENT_FOLDER), args.getString(ARGUMENT_CONTENT_NAME), props, (ContentFile) args.getSerializable(ARGUMENT_CONTENT_FILE)); }

Target:
public Loader<LoaderResult<Document>> onCreateLoader(int id, Bundle args) { Map<String, Serializable> props = new HashMap<String, Serializable>(3); props.put(ContentModel.PROP_DESCRIPTION, args.getString(ARGUMENT_CONTENT_DESCRIPTION)); props.put(ContentModel.PROP_TAGS, args.getStringArrayList(ARGUMENT_CONTENT_TAGS)); props.put(PropertyIds.OBJECT_TYPE_ID, ObjectType.DOCUMENT_BASETYPE_ID); String name = args.getString(ARGUMENT_CONTENT_NAME); ContentFile contentFile = (ContentFile) args.getSerializable(ARGUMENT_CONTENT_FILE); if (contentFile != null && name != null) { currentAccount = SessionUtils.getAccount(getActivity()); Bundle progressBundle = new Bundle(); if (contentFile.getClass() == ContentFileProgressImpl.class) { ((ContentFileProgressImpl) contentFile).setFilename(name); progressBundle.putString(ProgressNotification.PARAM_DATA_NAME, name); } else { progressBundle.putString(ProgressNotification.PARAM_DATA_NAME, contentFile.getFile().getName()); } progressBundle.putInt(ProgressNotification.PARAM_DATA_SIZE, (int) contentFile.getFile().length()); progressBundle.putInt(ProgressNotification.PARAM_DATA_INCREMENT, (int) (contentFile.getFile().length() / 10)); ProgressNotification.createProgressNotification(getActivity(), progressBundle, getActivity().getClass()); parentFolder = (Folder) getArguments().get(ARGUMENT_FOLDER); } return new DocumentCreateLoader(getActivity(), alfSession, (Folder) getArguments().get(ARGUMENT_FOLDER), args.getString(ARGUMENT_CONTENT_NAME), props, (ContentFile) args.getSerializable(ARGUMENT_CONTENT_FILE)); }
Source:
void onSubmitClicked(ClickEvent e) { if (validate()) { if (isTopic) { topic.content = editText.getText(); TopicController.get().updateTopic(topic); } else { if (replyId != null) { ReplyController.get(topic.id).updateReply(replyId, editText.getText()); } else { ReplyController.get(topic.id).addReply(replyId, editText.getText()); } } } }

Target:
void onSubmitClicked(ClickEvent e) { if (validate()) { if (isTopic) { topic.content = editText.getText(); TopicController.get().updateTopic(topic); } else { if (replyId != null) { ReplyController.get().getThread(topic.id).updateReply(replyId, editText.getText()); } else { ReplyController.get().getThread(topic.id).addReply(replyId, editText.getText()); } } } }
Source:
void test(SessionFactoryScope scope) { scope.inTransaction( session -> { final Person person = session.createQuery( "select p from Person p", Person.class ).getSingleResult(); final SortedSet<Phone> phones = person.getPhones(); assertThat( phones.size(), is( 3 ) ); } ); }

Target:
void test(SessionFactoryScope scope) { scope.inTransaction( session -> { final Person person = session.createQuery( "select p from Person p", Person.class ).getSingleResult(); final SortedSet<Phone> phones = person.getPhones(); assertThat( phones, IsIterableContainingInOrder.contains( new Phone( "123-456-789" ), new Phone( "234-567-891" ), new Phone( "345-678-912" ), new Phone( "456-789-123" ), new Phone( "567-891-234" ), new Phone( "678-912-345" ), new Phone( "789-123-456" ), new Phone( "891-234-567" ), new Phone( "912-345-678" ) ) ); } ); }
Source:
public DLNAMediaDatabase(String name) { String dir = "database"; dbName = name; File fileDir = new File(dir); boolean defaultLocation = fileDir.mkdir() || fileDir.exists(); if (defaultLocation) { String to_delete = "to_delete"; File checkDir = new File(to_delete); if (checkDir.exists()) { defaultLocation = checkDir.delete(); } else { defaultLocation = checkDir.mkdir(); if (defaultLocation) { defaultLocation = checkDir.delete(); } } } if (Platform.isWindows() && !defaultLocation) { String profileDir = PMS.getConfiguration().getProfileDirectory(); url = String.format("jdbc:h2:%s\\%s/%s", profileDir, dir, dbName); fileDir = new File(profileDir, dir); } else { url = "jdbc:h2:" + dir + "/" + dbName; } dbDir = fileDir.getAbsolutePath(); LOGGER.debug("Using database URL: " + url); LOGGER.info("Using database located at: " + dbDir); try { Class.forName("org.h2.Driver"); } catch (ClassNotFoundException e) { LOGGER.debug("Caught exception: " + e.getMessage()); } JdbcDataSource ds = new JdbcDataSource(); ds.setURL(url); ds.setUser("sa"); ds.setPassword(""); cp = JdbcConnectionPool.create(ds); }

Target:
public DLNAMediaDatabase(String name) { String dir = "database"; dbName = name; File fileDir = new File(dir); boolean defaultLocation = fileDir.mkdir() || fileDir.exists(); if (defaultLocation) { String to_delete = "to_delete"; File checkDir = new File(to_delete); if (checkDir.exists()) { defaultLocation = checkDir.delete(); } else { defaultLocation = checkDir.mkdir(); if (defaultLocation) { defaultLocation = checkDir.delete(); } } } if (Platform.isWindows() && !defaultLocation) { String profileDir = PMS.getConfiguration().getProfileDirectory(); url = String.format("jdbc:h2:%s\\%s/%s", profileDir, dir, dbName); fileDir = new File(profileDir, dir); } else { url = "jdbc:h2:" + dir + "/" + dbName; } dbDir = fileDir.getAbsolutePath(); LOGGER.debug("Using database URL: " + url); LOGGER.info("Using database located at: " + dbDir); try { Class.forName("org.h2.Driver"); } catch (ClassNotFoundException e) { LOGGER.error(null, e); } JdbcDataSource ds = new JdbcDataSource(); ds.setURL(url); ds.setUser("sa"); ds.setPassword(""); cp = JdbcConnectionPool.create(ds); }
Source:
public static void validateSinkTopic(ReadableConfig tableOptions) { String errorMessageTemp = "Flink Kafka sink currently only supports single topic, but got %s: %s."; if (!isSingleTopic(tableOptions)) { if (tableOptions.getOptional(TOPIC_PATTERN).isPresent()) { throw new ValidationException(String.format( errorMessageTemp, "'topic-pattern'", tableOptions.get(TOPIC_PATTERN) )); } else { throw new ValidationException(String.format( errorMessageTemp, "topic-list", tableOptions.get(TOPIC) )); } } }

Target:
public static void validateSinkTopic(ReadableConfig tableOptions) { String errorMessageTemp = "Flink Kafka sink currently only supports single topic, but got %s: %s."; if (!isSingleTopic(tableOptions)) { if (tableOptions.getOptional(TOPIC_PATTERN).isPresent()) { throw new ValidationException(String.format( errorMessageTemp, "'topic-pattern'", tableOptions.get(TOPIC_PATTERN) )); } else { throw new ValidationException(String.format( errorMessageTemp, "'topic'", tableOptions.get(TOPIC) )); } } }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ShutDownVspCommand)) return false; if (!super.equals(o)) return false; ShutDownVspCommand that = (ShutDownVspCommand) o; if (_dhcpOptions != null ? !_dhcpOptions.equals(that._dhcpOptions) : that._dhcpOptions != null) return false; if (_network != null ? !_network.equals(that._network) : that._network != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ShutDownVspCommand)) { return false; } ShutDownVspCommand that = (ShutDownVspCommand) o; return super.equals(that) && Objects.equals(_dhcpOptions, that._dhcpOptions) && Objects.equals(_network, that._network); }
Source:
public void importToKeystore() { if (null == uploadedFileServer || StringUtils.isBlank(alias)) { HelperUtil.addMessageError(null, "Alias and Server upload are required."); return; } SimpleCertificateResponseMessageType response; if (MapUtils.isNotEmpty(listIntermediate) && null != uploadedFileRoot) { response = service.importToKeystore(alias, uploadedFileServer, listIntermediate, uploadedFileRoot); } else { response = service.importToKeystore(alias, uploadedFileServer, null, null); } if (null == response) { HelperUtil.addMessageError(null, "Fail to import to keystore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to Keystore is successful: " + alias); } else { HelperUtil.addMessageError(null, response.getMessage()); } }

Target:
public void importToKeystore() { if (null == uploadedFileServer || StringUtils.isBlank(alias)) { HelperUtil.addMessageError(null, "Alias and Server Certificate are required."); return; } SimpleCertificateResponseMessageType response; if (MapUtils.isNotEmpty(listIntermediate) && null != uploadedFileRoot) { response = service.importToKeystore(alias, uploadedFileServer, listIntermediate, uploadedFileRoot); } else { response = service.importToKeystore(alias, uploadedFileServer, null, null); } if (null == response) { HelperUtil.addMessageError(null, "Fail to import to temporary keystore."); } else if (response.isStatus()) { HelperUtil.addMessageInfo(null, "Import to temporary keystore is successful: " + alias); } else { HelperUtil.addMessageError(null, response.getMessage()); } }
Source:
public void tearDown() throws Exception { testWorkspaceServiceClient.delete(WORKSPACE_NEW_NAME, workspace.getOwner().getName()); }

Target:
public void tearDown() throws Exception { testWorkspaceServiceClient.delete(WORKSPACE_NEW_NAME, testWorkspace.getOwner().getName()); }
Source:
public Class<?> getRawType() { return token.getRawType(); }

Target:
public Class<? super T> getRawType() { return token.getRawType(); }
Source:
public void getRandomPage() { if (getCallback() != null && getCard() != null) { setProgress(true); new RandomSummaryClient().request(getCard().wikiSite(), new RandomSummaryClient.Callback() { @Override public void onSuccess(@NonNull Call<RbPageSummary> call, @NonNull PageTitle title) { setProgress(false); if (getCallback() != null && getCard() != null) { getCallback().onSelectPage(getCard(), new HistoryEntry(title, HistoryEntry.SOURCE_FEED_RANDOM)); } } @Override public void onError(@NonNull Call<RbPageSummary> call, @NonNull Throwable t) { L.w("Failed to get random card from network. Falling back to reading lists.", t); getRandomPageFromCompilation(t); setProgress(false); } }); } }

Target:
public void getRandomPage() { if (getCallback() != null && getCard() != null) { setProgress(true); new RandomSummaryClient().request(getCard().wikiSite(), new RandomSummaryClient.Callback() { @Override public void onSuccess(@NonNull Call<RbPageSummary> call, @NonNull PageTitle title) { setProgress(false); if (getCallback() != null && getCard() != null) { getCallback().onSelectPage(getCard(), new HistoryEntry(title, HistoryEntry.SOURCE_FEED_RANDOM)); } } @Override public void onError(@NonNull Call<RbPageSummary> call, @NonNull Throwable t) { L.w("Failed to get random card from network. Falling back to compilations.", t); getRandomPageFromCompilation(t); setProgress(false); } }); } }
Source:
protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.error("Handling error for message type: " + messageType, e); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_ADMIN, "An unknown error occurred", e); } this.webServiceResponseMessageSender.send(ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build()); }

Target:
protected void handleError(final Exception e, final String correlationUid, final String organisationIdentification, final String deviceIdentification, final String messageType) { LOGGER.error("Handling error for message type: " + messageType, e); OsgpException osgpException = null; if (e instanceof OsgpException) { osgpException = (OsgpException) e; } else { osgpException = new TechnicalException(ComponentType.DOMAIN_ADMIN, "An unknown error occurred", e); } ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(correlationUid).withOrganisationIdentification(organisationIdentification) .withDeviceIdentification(deviceIdentification).withResult(ResponseMessageResultType.NOT_OK) .withOsgpException(osgpException).withDataObject(e).build(); this.webServiceResponseMessageSender.send(responseMessage); }
Source:
public static Map<String, String> constructMap(Properties properties) { Map<String, String> propsMap = null; Properties combinedProperties = ConfigManager.combineDefaultProperties(properties); propsMap = new HashMap<String, String>(); Enumeration<?> keys = combinedProperties.propertyNames(); while (keys.hasMoreElements()) { String key = keys.nextElement().toString().trim(); String value = combinedProperties.getProperty(key).trim(); propsMap.put(key, value); } return propsMap; }

Target:
public static Map<String, String> constructMap(Properties properties) { Properties combinedProperties = ConfigManager.combineDefaultProperties(properties); Map<String, String> propsMap = new HashMap<String, String>(); Enumeration<?> keys = combinedProperties.propertyNames(); while (keys.hasMoreElements()) { String key = keys.nextElement().toString().trim(); String value = combinedProperties.getProperty(key).trim(); propsMap.put(key, value); } return propsMap; }
Source:
private static RegularArgument getSecureArgument(List<Argument> arguments, int nArg) { return arguments.stream() .map(RegularArgument.class::cast) .filter(argument -> { Name keywordArgument = argument.keywordArgument(); return keywordArgument != null && keywordArgument.name().equals(SECURE); }) .findFirst().orElse(checkSensitivePositionalArgument(arguments, nArg)); }

Target:
private static RegularArgument getSecureArgument(List<Argument> arguments, int nArg) { return arguments.stream() .map(RegularArgument.class::cast) .filter(argument -> { Name keywordArgument = argument.keywordArgument(); return keywordArgument != null && keywordArgument.name().equals(SECURE); }) .findFirst().orElseGet(() -> checkSensitivePositionalArgument(arguments, nArg)); }
Source:
public void processStream(InputStream input) throws IOException { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) { String line; while ((line = in.readLine()) != null) { if (line.startsWith("R")) { String[] parts = line.split("\t"); if (parts.length < 3 || parts[1].length() <= 0 || renamedFiles.contains(parts[1])) { continue; } renamedFiles.add(parts[2]); } } } }

Target:
public void processStream(InputStream input) throws IOException { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) { String line; Pattern pattern = Pattern.compile("^R\\d+\\s.*"); while ((line = in.readLine()) != null) { if (pattern.matcher(line).matches()) { String[] parts = line.split("\t"); if (parts.length < 3 || parts[1].length() <= 0 || renamedFiles.contains(parts[1])) { continue; } renamedFiles.add(parts[2]); } } } }