auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void onClick(View v) { Log.d(TAG_FRAGMENT, "Clicked: " + v.getId()); switch (v.getId()) { case R.id.linear_layout_smb: dismiss(); SmbSearchDialog smbDialog=new SmbSearchDialog(); smbDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_scp: dismiss(); SftpConnectDialog sftpConnectDialog = new SftpConnectDialog(); Bundle args = new Bundle(); args.putBoolean("edit", false); sftpConnectDialog.setArguments(args); sftpConnectDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_box: ((MainActivity) getActivity()).addConnection(OpenMode.BOX); break; case R.id.linear_layout_dropbox: ((MainActivity) getActivity()).addConnection(OpenMode.DROPBOX); break; case R.id.linear_layout_google_drive: ((MainActivity) getActivity()).addConnection(OpenMode.GDRIVE); break; case R.id.linear_layout_onedrive: ((MainActivity) getActivity()).addConnection(OpenMode.ONEDRIVE); break; case R.id.linear_layout_get_cloud: Intent cloudPluginIntent = new Intent(Intent.ACTION_VIEW); cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_uri))); try { startActivity(cloudPluginIntent); } catch (ActivityNotFoundException ifGooglePlayIsNotInstalled) { cloudPluginIntent = new Intent(Intent.ACTION_VIEW); cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_web_uri))); startActivity(cloudPluginIntent); } break; } dismiss(); }

Target:
public void onClick(View v) { Log.d(TAG_FRAGMENT, "Clicked: " + v.getId()); switch (v.getId()) { case R.id.linear_layout_smb: dismiss(); SmbSearchDialog smbDialog=new SmbSearchDialog(); smbDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_scp: dismiss(); SftpConnectDialog sftpConnectDialog = new SftpConnectDialog(); Bundle args = new Bundle(); args.putBoolean("edit", false); sftpConnectDialog.setArguments(args); sftpConnectDialog.show(getActivity().getFragmentManager(), "tab"); return; case R.id.linear_layout_box: ((MainActivity) getActivity()).addConnection(OpenMode.BOX); break; case R.id.linear_layout_dropbox: ((MainActivity) getActivity()).addConnection(OpenMode.DROPBOX); break; case R.id.linear_layout_google_drive: ((MainActivity) getActivity()).addConnection(OpenMode.GDRIVE); break; case R.id.linear_layout_onedrive: ((MainActivity) getActivity()).addConnection(OpenMode.ONEDRIVE); break; case R.id.linear_layout_get_cloud: Intent cloudPluginIntent = new Intent(Intent.ACTION_VIEW); cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_uri))); try { startActivity(cloudPluginIntent); } catch (ActivityNotFoundException ifGooglePlayIsNotInstalled) { cloudPluginIntent.setData(Uri.parse(getString(R.string.cloud_plugin_google_play_web_uri))); startActivity(cloudPluginIntent); } break; } dismiss(); }
Source:
public void testJDBCBuilderUsingConnectionString() throws Exception { final String connectionUrl = "testConnectionUrl"; ResultSetMetaData metadata = createMock(ResultSetMetaData.class); try (Connection connection = EasyMock.createNiceMock(Connection.class);Statement statement = createMock(Statement.class);ResultSet resultSet = createMock(ResultSet.class)){ PowerMock.mockStatic(DriverManager.class); expect(DriverManager.getConnection(connectionUrl)).andReturn(connection).once(); expect(connection.createStatement()).andReturn(statement); expect(statement.executeQuery("select * from book")).andReturn(resultSet); expect(resultSet.getMetaData()).andReturn(metadata); if (resultSet.next()) { } expectLastCall().andAnswer(new IAnswer<Boolean>() { int called; @Override public Boolean answer() { called++; if (called < 2) { return true; } return false; } }).times(2); expect(resultSet.getObject("BOOK_ID", Comparable.class)).andReturn("1").times(1); expect(resultSet.getObject("TITLE", Comparable.class)).andReturn("Apache Knox: The Definitive Guide").times(1); expect(metadata.getTableName(1)).andReturn("BOOK"); expect(metadata.getColumnCount()).andReturn(2); expect(metadata.getColumnName(1)).andReturn("BOOK_ID").anyTimes(); expect(metadata.getColumnName(2)).andReturn("TITLE").anyTimes(); resultSet.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }).times(2); statement.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }).times(2); connection.close(); expectLastCall().andAnswer(new IAnswer<Object>() { @Override public Object answer() { return null; } }); PowerMock.replay(DriverManager.class); replay(connection, statement, resultSet, metadata); KnoxShellTable table = KnoxShellTable.builder().jdbc().connectTo("testConnectionUrl").sql("select * from book"); assertEquals(1, table.getRows().size()); } }

Target:
public void testJDBCBuilderUsingConnectionString() throws Exception { System.setProperty(SYSTEM_PROPERTY_DERBY_STREAM_ERROR_FILE, "/dev/null"); final Path derbyDatabaseFolder = Paths.get(testFolder.newFolder().toPath().toString(), SAMPLE_DERBY_DATABASE_NAME); Database derbyDatabase = null; try { derbyDatabase = prepareDerbyDatabase(derbyDatabaseFolder); assertTrue(derbyDatabase.hasTable("BOOKS")); final KnoxShellTable table = KnoxShellTable.builder().jdbc().driver(DerbyDatabase.DRIVER).connectTo(DerbyDatabase.PROTOCOL + derbyDatabaseFolder.toString()) .sql("select * from books"); assertEquals(2, table.getRows().size()); assertTrue(table.values("TITLE").containsAll(Arrays.asList("Apache Knox: The Definitive Guide", "Apache Knox: The Definitive Guide 2nd Edition"))); } finally { if (derbyDatabase != null) { derbyDatabase.shutdown(); } System.clearProperty(SYSTEM_PROPERTY_DERBY_STREAM_ERROR_FILE); } }
Source:
public void put(Collection<SinkRecord> records) throws ConnectException { try { if (hdfsWriter != null) { hdfsWriter.write(records); } } catch (ConnectException e) { throw new ConnectException(e); } }

Target:
public void put(Collection<SinkRecord> records) throws ConnectException { try { hdfsWriter.write(records); } catch (ConnectException e) { throw new ConnectException(e); } }
Source:
public final void addEndpoint(final Endpoint endpoint) { endpoint.setMessageDeliverer(deliverer); endpoint.setExecutor(executor); endpoints.add(endpoint); }

Target:
public void addEndpoint(final Endpoint endpoint) { endpoint.setMessageDeliverer(deliverer); endpoint.setExecutor(executor); endpoints.add(endpoint); }
Source:
private List<TokenCredential> getCredentialsChain() { List<TokenCredential> output = new ArrayList<>(4); if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }

Target:
private ArrayDeque<TokenCredential> getCredentialsChain() { ArrayDeque<TokenCredential> output = new ArrayDeque<>(4); if (!excludeEnvironmentCredential) { output.add(new EnvironmentCredential(identityClientOptions)); } if (!excludeManagedIdentityCredential) { output.add(new ManagedIdentityCredential(null, identityClientOptions)); } if (!excludeSharedTokenCacheCredential) { output.add(new SharedTokenCacheCredential(null, null, "04b07795-8ddb-461a-bbee-02f9e1bf7b46", identityClientOptions)); } if (!excludeAzureCliCredential) { output.add(new AzureCliCredential(identityClientOptions)); } if (output.size() == 0) { throw logger.logExceptionAsError(new IllegalArgumentException("At least one credential type must be" + " included in the authentication flow.")); } return output; }
Source:
public void onDestroy() { super.onDestroy(); if (getService() != null) { getService().unregisteronServiceStateChangeListener(this::onServiceStateChange); } mIdView.removeTextChangedListener(mIdTextWatcher); mNameView.removeTextChangedListener(mNameTextWatcher); mAddressesView.removeTextChangedListener(mAddressesTextWatcher); }

Target:
public void onDestroy() { super.onDestroy(); SyncthingService syncthingService = getService(); if (syncthingService != null) { syncthingService.unregisterOnServiceStateChangeListener(this::onServiceStateChange); } mIdView.removeTextChangedListener(mIdTextWatcher); mNameView.removeTextChangedListener(mNameTextWatcher); mAddressesView.removeTextChangedListener(mAddressesTextWatcher); }
Source:
List<SelfAddressProvider> selfAddressProviders(Environment environment) { return Lists.newArrayList( new RatelSelfAddressProvider(environment), new JbossSelfAddressProvider(environment), new LocalhostSelfAddressProvider() ); }

Target:
List<SelfAddressProvider> selfAddressProviders(Environment environment) { return Lists.newArrayList( new RatelPropertySelfAddressProvider(environment), new JbossPropertySelfAddressProvider(environment), new LocalhostSelfAddressProvider() ); }
Source:
public int compare(String o1, String o2) { if (o1 == o2) { return 0; } BigDecimal bd1 = convertStringToBigDecimal(o1); BigDecimal bd2 = convertStringToBigDecimal(o2); if (bd1 != null && bd2 != null) { return bd1.compareTo(bd2); } if (bd1 == null && bd2 == null) { return StringComparators.LEXICOGRAPHIC.compare(o1, o2); } if (bd1 == null) { return -1; } else { return 1; } }

Target:
public int compare(String o1, String o2) { if (o1 == o2) { return 0; } if (o1 == null) { return -1; } if (o2 == null) { return 1; } Long long1 = Longs.tryParse(o1); Long long2 = Longs.tryParse(o2); final BigDecimal bd1 = long1 == null ? convertStringToBigDecimal(o1) : new BigDecimal(long1); final BigDecimal bd2 = long2 == null ? convertStringToBigDecimal(o2) : new BigDecimal(long2); if (bd1 != null && bd2 != null) { return bd1.compareTo(bd2); } if (bd1 == null && bd2 == null) { return StringComparators.LEXICOGRAPHIC.compare(o1, o2); } if (bd1 == null) { return -1; } else { return 1; } }
Source:
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, engine); if (serverHostnameVerificationEnabled) { try { performHostVerification(InetAddress.getByName(engine.getPeerHost()), chain[0]); } catch (UnknownHostException e) { throw new CertificateException("failed to verify host", e); } } }

Target:
public void checkServerTrusted(X509Certificate[] chain, String authType, SSLEngine engine) throws CertificateException { x509ExtendedTrustManager.checkServerTrusted(chain, authType, engine); if (serverHostnameVerificationEnabled) { try { performHostVerification(InetAddress.getByName(engine.getPeerHost()), chain[0]); } catch (UnknownHostException e) { throw new CertificateException("Failed to verify host", e); } } }
Source:
public void verifyFromModuleHasHeadline() { List<WebElement> communityHeadlinesList = driver.findElements(fromCommunityHeadlinesBy); for (int i = 0; i < communityHeadlinesList.size(); i++) { PageObjectLogging.log("verifyFromModuleHasHeadline", "Checking headline number "+(i+1), true); scrollToElement(communityHeadlinesList.get(i)); waitForElementByElement(communityHeadlinesList.get(i)); } PageObjectLogging.log("verifyFromModuleHasHeadline", "Verify that from the community module has headline", true); }

Target:
public void verifyFromModuleHasHeadline() { for (WebElement element : fromCommunityHeadlines) { scrollToElement(element); waitForElementByElement(element); } PageObjectLogging.log( "verifyFromModuleHasHeadline", "Verify that from the community module has headline", true ); }
Source:
GerritCallback<ApprovalSummarySet> approvalFormatter( final int dataBegin, final int rows) { return new GerritCallback<ApprovalSummarySet>() { @Override public void onSuccess(final ApprovalSummarySet as) { Map<Change.Id, ApprovalSummary>ids = as.getSummaryMap(); for (int row = dataBegin; row < dataBegin + rows; row++) { final ChangeInfo c = getRowItem(row); if (ids.containsKey(c.getId())) { displayApprovals(row, ids.get(c.getId())); } } } }; }

Target:
GerritCallback<ApprovalSummarySet> approvalFormatter( final int dataBegin, final int rows) { return new GerritCallback<ApprovalSummarySet>() { @Override public void onSuccess(final ApprovalSummarySet as) { Map<Change.Id, ApprovalSummary> ids = as.getSummaryMap(); AccountInfoCache aic = as.getAccountInfoCache(); for (int row = dataBegin; row < dataBegin + rows; row++) { final ChangeInfo c = getRowItem(row); if (ids.containsKey(c.getId())) { displayApprovals(row, ids.get(c.getId()), aic); } } } }; }
Source:
private void addRequirePostCrumbHandler(WebApp webApp) { webApp.getResponseRenderers().add(0, new HttpResponseRenderer() { @Override public boolean generateResponse(StaplerRequest req, StaplerResponse rsp, Object node, Object response) throws IOException, ServletException { if (response instanceof HttpResponseException) { Class<?> c = response.getClass(); if (RequirePOST.Processor.class.equals(c.getEnclosingClass())) { CrumbIssuer crumbIssuer = getCrumbIssuer(); if (crumbIssuer != null) { String crumbFieldName = crumbIssuer.getDescriptor().getCrumbRequestField(); StringWriter output = new StringWriter(); final PrintWriter resWriter = new PrintWriter(output); StaplerResponse res = new StaplerResponseWrapper(rsp) { public PrintWriter getWriter() throws IOException { return resWriter; } }; ((HttpResponseException)response).generateResponse(req, res, node); String crumbHiddenInput = "<input type=\"hidden\" name=\""+crumbFieldName+"\" value=\""+crumbIssuer.getCrumb(req)+"\"/>"; rsp.getWriter().write(output.toString().replace("</form>",crumbHiddenInput+"</form>")); return true; } } } return false; } }); }

Target:
private void addRequirePostCrumbHandler(WebApp webApp) { webApp.getResponseRenderers().add(0, new HttpResponseRenderer() { @Override public boolean generateResponse(StaplerRequest req, StaplerResponse rsp, Object node, Object response) throws IOException, ServletException { if (response instanceof HttpResponseException) { Class<?> c = response.getClass(); if (POST_PROCESSOR_EXCEPTION_CLASS_NAME.equals(c.getName())) { CrumbIssuer crumbIssuer = getCrumbIssuer(); if (crumbIssuer != null) { String crumbFieldName = crumbIssuer.getDescriptor().getCrumbRequestField(); StringWriter output = new StringWriter(); final PrintWriter resWriter = new PrintWriter(output); StaplerResponse res = new StaplerResponseWrapper(rsp) { public PrintWriter getWriter() throws IOException { return resWriter; } @Override public void setContentLengthLong(long len) { getWrapped().setContentLengthLong(len); } @Override public void setCharacterEncoding(String charset) { getWrapped().setCharacterEncoding(charset); } @Override public String getContentType() { return getWrapped().getContentType(); } @Override public int getStatus() { return getWrapped().getStatus(); } @Override public Collection<String> getHeaders(String name) { return getWrapped().getHeaders(name); } @Override public Collection<String> getHeaderNames() { return getWrapped().getHeaderNames(); } @Override public String getHeader(String name) { return getWrapped().getHeader(name); } }; ((HttpResponseException)response).generateResponse(req, res, node); String crumbHiddenInput = "<input type=\"hidden\" name=\""+crumbFieldName+"\" value=\""+crumbIssuer.getCrumb(req)+"\"/>"; rsp.getWriter().write(output.toString().replace("</form>",crumbHiddenInput+"</form>")); return true; } } } return false; } }); }
Source:
private String[] findInheritedStringArray(Class<?> cls, String methodName) { if (null == cls) { return new String[0]; } List<String> result = Lists.newArrayList(); while (cls != null && cls != Object.class) { Annotation annotation = cls.getAnnotation((Class<? extends Annotation>) Test.class); if (annotation != null) { String[] g = (String[]) invokeMethod(annotation, methodName); result.addAll(Arrays.asList(g)); } cls = cls.getSuperclass(); } return result.toArray(new String[0]); }

Target:
private String[] findInheritedStringArray(Class<?> cls, String methodName) { if (null == cls) { return new String[0]; } List<String> result = Lists.newArrayList(); while (cls != null && cls != Object.class) { Annotation annotation = cls.getAnnotation(Test.class); if (annotation != null) { String[] g = (String[]) invokeMethod(annotation, methodName); result.addAll(Arrays.asList(g)); } cls = cls.getSuperclass(); } return result.toArray(new String[0]); }
Source:
private boolean wasNotJustMarkedAsRead(TurboIssue issue) { if (!issue.isCurrentlyRead() || !issue.getMarkedReadAt().isPresent()) return false; LocalDateTime markedReadAt = issue.getMarkedReadAt().get(); LocalDateTime updatedAt = issue.getUpdatedAt(); if (updatedAt.isAfter(markedReadAt)) { return true; } else if (updatedAt.isBefore(markedReadAt) && (markedReadAt.toEpochSecond(null) - updatedAt.toEpochSecond(null) < 3L)) { return true; } else { return false; } }

Target:
private boolean wasNotJustMarkedAsRead(TurboIssue issue) { if (!issue.isCurrentlyRead() || !issue.getMarkedReadAt().isPresent()) return false; LocalDateTime markedReadAt = issue.getMarkedReadAt().get(); LocalDateTime updatedAt = issue.getUpdatedAt(); if (updatedAt.isBefore(markedReadAt) && (updatedAt.until(markedReadAt, ChronoUnit.SECONDS) < 3L)) { return false; } else if (updatedAt.isAfter(markedReadAt)) { return true; } else { return false; } }
Source:
public void onEditTabSelected() { scenarioSimulationEditorBusinessClientWrapper.onEditTabSelected(); verify(scenarioSimulationEditorPresenterMock, times(1)).setFocusedContext(eq(scenarioSimulationContextLocal)); verify(scenarioSimulationEditorPresenterMock, times(1)).setItemMenuForMainGridEnabled(true); }

Target:
public void onEditTabSelected() { scenarioSimulationEditorBusinessClientWrapper.onEditTabSelected(); verify(scenarioSimulationEditorPresenterMock, times(1)).setFocusedContext(eq(scenarioSimulationContextLocal)); verify(scenarioSimulationEditorPresenterMock, times(1)).setItemMenuForMainGridEnabled(eq(true)); verify(scenarioGridWidgetMock, times(1)).clearSelections(); verify(scenarioGridWidgetMock, times(1)).select(); verify(backgroundGridWidgetMock, times(1)).deselect(); }
Source:
private void updateFileEncoding(final String encoding) throws CoreException, OperationCanceledException { final org.eclipse.core.resources.IFile file = getDelegate(); if (!file.exists()) return; String projectEncoding = file.getProject().getDefaultCharset(); String fileEncoding = file.getCharset(); if (encoding.equals(fileEncoding)) { log.debug("encoding does not need to be changed for file: " + file); return; } if (encoding.equals(projectEncoding)) { log.debug( "changing encoding for file " + file + " to use default project encoding: " + projectEncoding); file.setCharset(null, new NullProgressMonitor()); return; } log.debug("changing encoding for file " + file + " to encoding: " + encoding); file.setCharset(encoding, new NullProgressMonitor()); }

Target:
private void updateFileEncoding(final String encoding) throws CoreException, OperationCanceledException { final org.eclipse.core.resources.IFile file = getDelegate(); if (!file.exists()) return; String fileEncoding = file.getCharset(); if (encoding.equals(fileEncoding)) { log.debug("encoding does not need to be changed for file: " + file); return; } String parentContainerEncoding = file.getParent().getDefaultCharset(); if (encoding.equals(parentContainerEncoding)) { log.debug( "changing encoding for file " + file + " to inherit parent container encoding: " + parentContainerEncoding); file.setCharset(null, new NullProgressMonitor()); return; } log.debug("changing encoding for file " + file + " to encoding: " + encoding); file.setCharset(encoding, new NullProgressMonitor()); }
Source:
public static Response put(URI uri) throws URISyntaxException, HttpException { return putBody(new HttpPut(uri), StringUtils.EMPTY, ContentType.APPLICATION_JSON, null, null); }

Target:
public static Response put(URI uri) throws URISyntaxException, HttpException { return putBody(new HttpPut(uri), null, null, null, null); }
Source:
private void updateRecents() { this.recents.clearRecents(); String[] recentGames = null; String preference = this.controller.getPreferences().getString( Preferences.RECENT_GAMES); if (preference != null && preference.contains(";")) { recentGames = preference.split(";"); } if (recentGames == null || "".equals(recentGames)) { return; } else { for (String recentGame : recentGames) { if (recentGame.isEmpty()) { continue; } Project project = new Project(); project.setTitle("Project's title"); project.setDescription(recentGame); this.recents.addRecent(new ProjectButton(project, this.skin)); } } }

Target:
private void updateRecents() { this.recents.clearRecents(); String[] recentGames = null; String preference = this.controller.getPreferences().getString( Preferences.RECENT_GAMES); if (preference != null && preference.contains(";")) { recentGames = preference.split(";"); } if (recentGames == null || "".equals(recentGames)) { return; } else { final EditorAssets editorAssets = controller.getEditorAssets(); final String ending = File.separator + "project.json"; for (String recentGame : recentGames) { if (recentGame.isEmpty()) { continue; } Project project = editorAssets.fromJson(Project.class, Gdx.files.absolute(recentGame + ending)); this.recents.addRecent(new ProjectButton(project, this.skin)); } } }
Source:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlaced.size(); i++) { if (ordersPlaced.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } else { Order tmpOrder = null; for (int i = 0; i < position.size(); i++) { if (position.get(i).getStockSymbol() == symbol){ tmpOrder = position.get(i); } } if (!OrderUtility.owns(position, symbol)) { throw new StockMarketExpection("Cannot sell stock you do not own. Stock: " + symbol); } else if (tmpOrder.getSize() < volume) { throw new StockMarketExpection("Cannot sell more stock than you own. Stock: " + symbol + "Owned: " + volume); } else { SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlaced.add(order); m.addOrder(order); } } } else { throw new StockMarketExpection("Invalid Stock: " + symbol); } }

Target:
public void placeNewOrder(Market m, String symbol, int volume, double price, OrderType orderType) throws StockMarketExpection { Stock stock = m.getStockForSymbol(symbol); if (stock != null){ for (int i = 0; i < ordersPlacedByTrader.size(); i++) { if (ordersPlacedByTrader.get(i).getStockSymbol() == symbol){ throw new StockMarketExpection("Cannot place multiple orders for the same Stock: " + symbol); } } if (orderType.equals(OrderType.BUY)) { if (stock.getPrice() * volume > cashInHand) { throw new StockMarketExpection("Cannot place order for stock: " + symbol + " since there is not enough money. Trader: " + name); } BuyOrder order = new BuyOrder(symbol, volume, price, this); this.ordersPlacedByTrader.add(order); m.addOrder(order); } else { Order tmpOrder = null; for (int i = 0; i < stocksOwnedByTrader.size(); i++) { if (stocksOwnedByTrader.get(i).getStockSymbol() == symbol){ tmpOrder = stocksOwnedByTrader.get(i); } } checkForError(symbol, volume, tmpOrder); SellOrder order = new SellOrder(symbol, volume, price, this); this.ordersPlacedByTrader.add(order); m.addOrder(order); } } else { throw new StockMarketExpection("Invalid Stock: " + symbol); } }
Source:
public static Request createMockRequest() { Request request = new Request(); request.setTitle("Beer Wanted"); request.setDescription( "It's a beautiful day, I've got a sandwich, " + "but I lack a beverage. When considering what beverage " + "I'd enjoy, I decided on a beer. Please, I need a beer." ); request.setCents(150); User client = new User(); client.setName("Herp Derpington"); client.setLocation(37.7583, -122.4275); client.setEmail("jazoff-facilitator@gmail.com"); request.setClient(client); User vendor = new User(); vendor.setName("Derp Herpington"); vendor.setLocation(37.7583, -122.4275); vendor.setEmail("jazoff+vendor@gmail.com"); request.setVendor(vendor); return request; }

Target:
public static Request createMockRequest() { Request request = new Request(Request.State.OPEN); request.setTitle("Beer Wanted"); request.setDescription( "It's a beautiful day, I've got a sandwich, " + "but I lack a beverage. When considering what beverage " + "I'd enjoy, I decided on a beer. Please, I need a beer." ); request.setCents(150); User client = new User(); client.setName("Herp Derpington"); client.setLocation(37.7583, -122.4275); client.setEmail("jazoff-facilitator@gmail.com"); request.setClient(client); User vendor = new User(); vendor.setName("Derp Herpington"); vendor.setLocation(37.7583, -122.4275); vendor.setEmail("jazoff+vendor@gmail.com"); request.setVendor(vendor); return request; }
Source:
public SecretAsContainerResourceProvisioner( @Named("che.workspace.provision.secret.labels") String[] labels) { this.secretLabels = new HashMap<>(); for (String keyValue : labels) { String[] pair = keyValue.split("=", 2); secretLabels.put(pair[0], pair.length == 1 ? "" : pair[1]); } }

Target:
public SecretAsContainerResourceProvisioner( @Named("che.workspace.provision.secret.labels") String[] labels) { this.secretLabels = Arrays.stream(labels) .map(item -> item.split("=", 2)) .collect(toMap(p -> p[0], p -> p.length == 1 ? "" : p[1])); }
Source:
public ASTValue eval(Environment environment) throws WordsRuntimeException { ASTValue varName = children.get(0).eval(environment); ASTValue rawValue = children.get(1).eval(environment); Variable value = null; if (rawValue.type == ASTValue.Type.NUM) { value = new Variable(rawValue.numValue); } else if (rawValue.type == ASTValue.Type.STRING) { value = new Variable(rawValue.stringValue); } environment.createLocalVariable(varName.stringValue, value); return null; }

Target:
public ASTValue eval(Environment environment) throws WordsRuntimeException { ASTValue varName = children.get(0).eval(environment); ASTValue rawValue = children.get(1).eval(environment); Variable value = null; if (rawValue.type == ASTValue.Type.NUM) { value = new Variable(rawValue.numValue); } else if (rawValue.type == ASTValue.Type.STRING) { value = new Variable(rawValue.stringValue); } else { throw new InvalidLocalVariableException(); } environment.createLocalVariable(varName.stringValue, value); return null; }
Source:
protected abstract UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException; protected abstract GroupDetails retrieveGroup(String groupname); protected abstract boolean canRetrieveUserByName(); public GroupDetails loadGroupByGroupname(String groupname) { if( this.realm!=null && this.realm.getSsoEnabled()!=null && this.realm.getSsoEnabled().getCheckMode()!=null && this.realm.getSsoEnabled().getCheckMode().equalsIgnoreCase("no_check")==true && this.realm.getSsoEnabled().getDefaultGroup()!=null && this.realm.getSsoEnabled().getDefaultGroup().equals(groupname)==true) return new ActiveDirectoryGroupDetails(groupname); else return retrieveGroup(groupname); }

Target:
protected abstract UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException; protected abstract boolean canRetrieveUserByName(); public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException { return retrieveUser(username,null); }
Source:
public TopicStatus(String topic, ConnectorTaskId task, long discoverTimestamp) { this.topic = topic; this.connector = task.connector(); this.task = task.task(); this.discoverTimestamp = discoverTimestamp; }

Target:
public TopicStatus(String topic, ConnectorTaskId task, long discoverTimestamp) { this(topic, task.connector(), task.task(), discoverTimestamp); }
Source:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = dbTimeZone == null ? TimeZone.getTimeZone(ZoneOffset.UTC) : TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); }

Target:
public JdbcSinkConfig(Map<?, ?> props) { super(CONFIG_DEF, props); connectionUrl = getString(CONNECTION_URL); connectionUser = getString(CONNECTION_USER); connectionPassword = getPasswordValue(CONNECTION_PASSWORD); tableNameFormat = getString(TABLE_NAME_FORMAT).trim(); batchSize = getInt(BATCH_SIZE); maxRetries = getInt(MAX_RETRIES); retryBackoffMs = getInt(RETRY_BACKOFF_MS); autoCreate = getBoolean(AUTO_CREATE); autoEvolve = getBoolean(AUTO_EVOLVE); insertMode = InsertMode.valueOf(getString(INSERT_MODE).toUpperCase()); pkMode = PrimaryKeyMode.valueOf(getString(PK_MODE).toUpperCase()); pkFields = getList(PK_FIELDS); dialectName = getString(DIALECT_NAME_CONFIG); fieldsWhitelist = new HashSet<>(getList(FIELDS_WHITELIST)); String dbTimeZone = getString(DB_TIMEZONE_CONFIG); timeZone = TimeZone.getTimeZone(ZoneId.of(dbTimeZone)); }
Source:
private static String autoValuePropToBuilderSetterName( String prop, Set<String> builderSetterNames) { Set<String> possiblePropNames = new LinkedHashSet<>(); possiblePropNames.add(prop); if (prop.startsWith("get") && prop.length() > 3 && Character.isUpperCase(prop.charAt(3))) { possiblePropNames.add(Introspector.decapitalize(prop.substring(3))); } else if (prop.startsWith("is") && prop.length() > 2 && Character.isUpperCase(prop.charAt(2))) { possiblePropNames.add(Introspector.decapitalize(prop.substring(2))); } for (String propName : possiblePropNames) { HashSet<String> setterNamesToTry = new HashSet<>(); setterNamesToTry.add(propName); setterNamesToTry.add("set" + BuilderFrameworkSupportUtils.capitalize(propName)); for (String setterName : setterNamesToTry) { if (builderSetterNames.contains(setterName)) { return setterName; } } } return null; }

Target:
private static String autoValuePropToBuilderSetterName( String prop, Set<String> builderSetterNames) { String[] possiblePropNames; if (prop.startsWith("get") && prop.length() > 3 && Character.isUpperCase(prop.charAt(3))) { possiblePropNames = new String[] {prop, Introspector.decapitalize(prop.substring(3))}; } else if (prop.startsWith("is") && prop.length() > 2 && Character.isUpperCase(prop.charAt(2))) { possiblePropNames = new String[] {prop, Introspector.decapitalize(prop.substring(2))}; } else { possiblePropNames = new String[] {prop}; } for (String propName : possiblePropNames) { if (builderSetterNames.contains(propName)) { return propName; } String setterName = "set" + BuilderFrameworkSupportUtils.capitalize(propName); if (builderSetterNames.contains(setterName)) { return setterName; } } return null; }
Source:
public boolean isValidValue(String value) { try { if (this == NUMERIC_BIGDECIMAL) { new BigDecimal(value); } else if (this == NUMERIC_BIGINTEGER) { new BigInteger(value); } else if (this == NUMERIC_BYTE) { new Byte(value); } else if (this == NUMERIC_DOUBLE) { new Double(value); } else if (this == NUMERIC_FLOAT) { new Float(value); } else if (this == NUMERIC_INTEGER) { new Integer(value); } else if (this == NUMERIC_LONG) { new Long(value); } else if (this == NUMERIC_SHORT) { new Short(value); } else if (this == BOOLEAN) { return value.trim().equalsIgnoreCase("true") || value.trim().equalsIgnoreCase("false"); } } catch (Exception e) { return false; } return true; }

Target:
public boolean isValidValue(String value) { return true; }
Source:
public String getPartitionKey() { if (docId != null) { return docId; } else if (docIds != null && docIds.size() > 0) { return docIds.get(0); } return getId(); }

Target:
public String getPartitionKey() { if (docId != null) { return docId; } else if (docIds != null && !docIds.isEmpty()) { return docIds.get(0); } return getId(); }
Source:
public AuditLogType getAuditLogTypeValue() { addCustomValue("SessionID", StringUtils.isEmpty(sessionId) ? UNKNOWN : sessionId); addCustomValue("SourceIP", StringUtils.isEmpty(sourceIp) ? UNKNOWN : sourceIp); addCustomValue("LoginErrMsg", ""); if (getSucceeded()) { return AuditLogType.USER_VDC_LOGIN; } else { if (getActionReturnValue() == CreateUserSessionsError.NUM_OF_SESSIONS_EXCEEDED) { addCustomValue("MaxUserSessions", String.valueOf(maxUserSessions)); return AuditLogType.USER_MAX_SESSIONS_EXCEEDED; } else { return AuditLogType.USER_VDC_LOGIN_FAILED; } } }

Target:
public AuditLogType getAuditLogTypeValue() { addCustomValue("SessionID", StringUtils.isEmpty(sessionId) ? UNKNOWN : sessionId); addCustomValue("SourceIP", StringUtils.isEmpty(sourceIp) ? UNKNOWN : sourceIp); addCustomValue("LoginErrMsg", ""); if (getSucceeded()) { return AuditLogType.USER_VDC_LOGIN; } if (getActionReturnValue() == CreateUserSessionsError.NUM_OF_SESSIONS_EXCEEDED) { addCustomValue("MaxUserSessions", String.valueOf(maxUserSessions)); return AuditLogType.USER_MAX_SESSIONS_EXCEEDED; } return AuditLogType.USER_VDC_LOGIN_FAILED; }
Source:
public static Predicate<ClusterProcess> marathon() { return abstractContainer -> abstractContainer instanceof Marathon; }

Target:
public static Predicate<ClusterProcess> marathon() { return process -> process instanceof Marathon; }
Source:
public String getRoleDescription(String role) { return NLS.get("Permission." + role + ".description"); }

Target:
public String getRoleDescription(String role) { return Permissions.getPermissionDescription(role); }
Source:
public void display(IDebuggerConsole console) { if (console.equals(getCurrentConsole())) { return; } DebuggerConsoleWorkbenchPart part = fConsoleToPart.get(console); if (part != null) { partActivated(part); } }

Target:
public void display(IDebuggerConsole console) { if (console.equals(getCurrentConsole())) { return; } DebuggerConsoleWorkbenchPart part = fConsoleToPart.get(console); if (part != null) { partActivated(part); fActiveConsole.consoleSelected(); } }
Source:
public PageProcessor(Optional<PageFilter> filter, List<? extends PageProjection> projections) { this.filter = requireNonNull(filter, "filter is null") .map(pageFilter -> { if (pageFilter.getInputChannels().size() == 1 && pageFilter.isDeterministic()) { return new DictionaryAwarePageFilter(pageFilter); } return pageFilter; }); this.projections = requireNonNull(projections, "projections is null").stream() .map(projection -> { if (projection.getInputChannels().size() == 1 && projection.isDeterministic()) { return new DictionaryAwarePageProjection(projection, dictionarySourceIdFunction); } return projection; }) .collect(toImmutableList()); }

Target:
public PageProcessor(Optional<PageFilter> filter, List<? extends PageProjection> projections) { this(filter, projections, OptionalInt.of(1)); }
Source:
private boolean isSparsifyCommandAvailable() { ArrayList<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (isDiskLocked(disk) || (!isVmDown() && disk.getPlugged())) { return false; } } return true; }

Target:
private boolean isSparsifyCommandAvailable() { List<Disk> disks = getSelectedItems() != null ? Linq.<Disk> cast(getSelectedItems()) : new ArrayList<Disk>(); for (Disk disk : disks) { if (isDiskLocked(disk) || (!isVmDown() && disk.getPlugged())) { return false; } } return true; }
Source:
public void onEvent(CourseUpgradedEvent event) { EventBus.getDefault().removeStickyEvent(CourseUpgradedEvent.class); if (!isOnCourseOutline || isVideoMode) { return; } hidePaymentsBanner(); getCourseComponentFromServer(true); }

Target:
public void onEvent(CourseUpgradedEvent event) { if (!isOnCourseOutline || isVideoMode) { return; } hidePaymentsBanner(); getCourseComponentFromServer(true); }
Source:
public FluoConfiguration setPositiveInt(String property, int value) { Preconditions.checkArgument(value > 0, property+" must be positive"); setProperty(property, value); return this; }

Target:
private FluoConfiguration setPositiveInt(String property, int value) { Preconditions.checkArgument(value > 0, property+" must be positive"); setProperty(property, value); return this; }
Source:
protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, CeWorkerImpl.class, CeWorkerFactoryImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class); }

Target:
protected void configureModule() { add( CeTaskProcessorRepositoryImpl.class, CeWorkerFactoryImpl.class, CeProcessingSchedulerExecutorServiceImpl.class, CeProcessingSchedulerImpl.class); }
Source:
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } if (e instanceof NumberFormatException) { throw new RuntimeException("Error compiling query: " + e.toString() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }

Target:
public synchronized CompiledPlan planSqlCore(String sql, StatementPartitioning partitioning) { TrivialCostModel costModel = new TrivialCostModel(); DatabaseEstimates estimates = new DatabaseEstimates(); CompiledPlan plan = null; try (QueryPlanner planner = new QueryPlanner( sql, "PlannerTool", "PlannerToolProc", m_database, partitioning, m_hsql, estimates, !VoltCompiler.DEBUG_MODE, costModel, null, null, DeterminismMode.FASTER, false)) { planner.parse(); plan = planner.plan(); assert(plan != null); } catch (Exception e) { String loggedMsg = ""; if (!(e instanceof PlanningErrorException || e instanceof HSQLParseException)) { logException(e, "Error compiling query"); loggedMsg = " (Stack trace has been written to the log.)"; } if (e.getMessage() != null) { throw new RuntimeException("SQL error while compiling query: " + e.getMessage() + loggedMsg, e); } throw new RuntimeException("SQL error while compiling query: " + e.toString() + loggedMsg, e); } if (plan == null) { throw new RuntimeException("Null plan received in PlannerTool.planSql"); } return plan; }
Source:
public SimpleInterval getLocation() { if (getReadUnmappedFlag()) { return null; } else { return new SimpleInterval(mReferenceName, mAlignmentStart, mAlignmentEnd); } }

Target:
public SimpleInterval getLocation() { if (getReadUnmappedFlag()) { return null; } else { return new SimpleInterval(getReferenceName(), getAlignmentStart(), getAlignmentEnd()); } }
Source:
public static boolean isCheckoutUpdateRequired(final Checkout checkout, final MaskedWallet maskedWallet) { if (checkout == null) { throw new NullPointerException("checkout cannot be null"); } if (maskedWallet == null) { throw new NullPointerException("maskedWallet cannot be null"); } Address shippingAddress = null; if (checkout.isRequiresShipping()) { shippingAddress = createShopifyAddress(maskedWallet.getBuyerShippingAddress()); } final Address billingAddress = createShopifyAddress(maskedWallet.getBuyerBillingAddress()); return (checkout.isRequiresShipping() && shippingAddress != null && !shippingAddress.locationsAreEqual(checkout.getShippingAddress())) || !billingAddress.locationsAreEqual(checkout.getBillingAddress()) || !TextUtils.equals(maskedWallet.getEmail(), checkout.getEmail()); }

Target:
public static boolean isCheckoutUpdateRequired(final Checkout checkout, final MaskedWallet maskedWallet) { if (checkout == null) { throw new NullPointerException("checkout cannot be null"); } if (maskedWallet == null) { throw new NullPointerException("maskedWallet cannot be null"); } return isShippingAddressChanged(checkout, maskedWallet) || isBillingAddressChanged(checkout, maskedWallet) || isEmailChanged(checkout, maskedWallet); }
Source:
public void everyoneCanUpdateEntry() { DocumentModel entry = groupDirSession.getEntry("members"); assertNotNull(entry); assertEquals("cn=members,ou=editable,ou=groups,dc=example,dc=com", entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "dn")); assertEquals(List.of("submembers"), entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "subGroups")); entry.setProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "description", "AWonderfulGroup"); entry.setProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "members", Arrays.asList("user1", "user2")); groupDirSession.updateEntry(entry); entry = groupDirSession.getEntry("members"); Assert.assertEquals("AWonderfulGroup", entry.getProperty(ExternalLDAPDirectoryFeature.GROUP_SCHEMANAME, "description")); }

Target:
public void everyoneCanUpdateEntry() { DocumentModel entry = groupDirSession.getEntry("members"); assertNotNull(entry); assertEquals("cn=members,ou=editable,ou=groups,dc=example,dc=com", entry.getProperty(GROUP_SCHEMANAME, "dn")); assertEquals(List.of("submembers"), entry.getProperty(GROUP_SCHEMANAME, "subGroups")); entry.setProperty(GROUP_SCHEMANAME, "description", "AWonderfulGroup"); entry.setProperty(GROUP_SCHEMANAME, "members", Arrays.asList("user1", "user2")); groupDirSession.updateEntry(entry); entry = groupDirSession.getEntry("members"); assertEquals("AWonderfulGroup", entry.getProperty(GROUP_SCHEMANAME, "description")); }
Source:
private void addDependenciesForTests() { additionalRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.core.runtime", VersionRange.emptyRange, null, true, true, true)); additionalRequirements.add(MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, "org.eclipse.ui.ide.application", VersionRange.emptyRange, null, true, true, true)); }

Target:
private void addDependenciesForTests() { additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.equinox.launcher")); additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.core.runtime")); additionalRequirements.add(optionalGreedyRequirementTo("org.eclipse.ui.ide.application")); }
Source:
public void tearDown() { col.drop(); client.close(); }

Target:
public void tearDown() { col.drop(); }
Source:
private void traceBlockPowerStartSolid(GlowBlock srcBlock, RSManager rsManager, BlockFace toDir, boolean isDirect) { GlowBlock destBlock = srcBlock.getRelative(toDir); if (destBlock == null) { return; } Material destMat = destBlock.getType(); if (destMat == Material.REDSTONE_WIRE) { } else { return; } rsManager.traceFromBlock(srcBlock, toDir, 15, isDirect); }

Target:
private void traceBlockPowerStartSolid(GlowBlock srcBlock, RSManager rsManager, BlockFace toDir, boolean isDirect) { GlowBlock destBlock = srcBlock.getRelative(toDir); if (destBlock == null) { return; } Material destMat = destBlock.getType(); if (destMat != Material.REDSTONE_WIRE) { return; } rsManager.traceFromBlock(srcBlock, toDir, 15, isDirect); }
Source:
protected boolean set(Entity dataHolder, Boolean value) { dataHolder.setGlowing(checkNotNull(value)); return true; }

Target:
protected boolean set(Entity dataHolder, Boolean value) { dataHolder.setGlowing(checkNotNull(value, "value")); return true; }
Source:
public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb == null || authenticationDb.isEmpty()) { return new MongoClient(); } else { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } MongoCredential mongoCredential = MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray()); return new MongoClient(servers, Collections.singletonList(mongoCredential)); } }

Target:
public static MongoClient getMongoClient(Properties properties) throws UnknownHostException { String[] hosts = properties.getProperty("eva.mongo.host").split(","); List<ServerAddress> servers = new ArrayList<>(); for (String host : hosts) { String[] params = host.split(":"); if (params.length > 1) { servers.add(new ServerAddress(params[0], Integer.parseInt(params[1]))); } else { servers.add(new ServerAddress(params[0], 27017)); } } List<MongoCredential> mongoCredentialList = null; String authenticationDb = properties.getProperty("eva.mongo.auth.db", null); if (authenticationDb != null && !authenticationDb.isEmpty()) { mongoCredentialList = Collections.singletonList(MongoCredential.createCredential( properties.getProperty("eva.mongo.user"), authenticationDb, properties.getProperty("eva.mongo.passwd").toCharArray())); } return new MongoClient(servers, mongoCredentialList); }
Source:
protected AllelicCount createRecord(final DataLine dataLine) { final String contig = dataLine.get(AllelicCountTableColumn.CONTIG); final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]); final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]); final SimpleInterval interval = new SimpleInterval(contig, position, position); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide); }

Target:
protected AllelicCount createRecord(final DataLine dataLine) { try { final String contig = dataLine.get(AllelicCountTableColumn.CONTIG); final int position = dataLine.getInt(AllelicCountTableColumn.POSITION); final int refReadCount = dataLine.getInt(AllelicCountTableColumn.REF_COUNT); final int altReadCount = dataLine.getInt(AllelicCountTableColumn.ALT_COUNT); final Nucleotide refNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.REF_NUCLEOTIDE.name()).getBytes()[0]); final Nucleotide altNucleotide = Nucleotide.valueOf(dataLine.get(AllelicCountTableColumn.ALT_NUCLEOTIDE.name()).getBytes()[0]); final SimpleInterval interval = new SimpleInterval(contig, position, position); return new AllelicCount(interval, refReadCount, altReadCount, refNucleotide, altNucleotide); } catch (final IllegalArgumentException e) { throw new UserException.BadInput("AllelicCountCollection file must have all columns specified."); } }