auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Test void testOne() { DirectedGraph<String, DefaultEdge> g = DefaultDirectedGraph.create(); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addVertex("E"); g.addVertex("F"); g.addEdge("A", "B"); g.addEdge("B", "C"); g.addEdge("D", "C"); g.addEdge("C", "D"); g.addEdge("E", "F"); g.addEdge("C", "C"); assertEquals("[A, B, C, D]", shortestPath(g, "A", "D").toString()); g.addEdge("B", "D"); assertEquals("[A, B, D]", shortestPath(g, "A", "D").toString()); assertNull(shortestPath(g, "A", "E"), "There is no path from A to E"); assertEquals("[]", shortestPath(g, "D", "D").toString()); assertNull(shortestPath(g, "X", "A"), "Node X is not in the graph"); assertEquals("[[A, B, D], [A, B, C, D]]", paths(g, "A", "D").toString()); }

Target:
@Test void testOne() { DirectedGraph<String, DefaultEdge> g = DefaultDirectedGraph.create(); g.addVertex("A"); g.addVertex("B"); g.addVertex("C"); g.addVertex("D"); g.addVertex("E"); g.addVertex("F"); g.addEdge("A", "B"); g.addEdge("B", "C"); g.addEdge("D", "C"); g.addEdge("C", "D"); g.addEdge("E", "F"); g.addEdge("C", "C"); assertEquals("[A, B, C, D]", shortestPath(g, "A", "D").toString()); g.addEdge("B", "D"); assertEquals("[A, B, D]", shortestPath(g, "A", "D").toString()); assertNull(shortestPath(g, "A", "E"), "There is no path from A to E"); assertEquals("[D]", shortestPath(g, "D", "D").toString()); assertNull(shortestPath(g, "X", "A"), "Node X is not in the graph"); assertEquals("[[A, B, D], [A, B, C, D]]", paths(g, "A", "D").toString()); }
Source:
public void addArgumentsToInstallFeatures(String repositoryLocation, String destination, String profile) { programArguments.add("-metadataRepository"); programArguments.add(repositoryLocation); programArguments.add("-artifactRepository"); programArguments.add(repositoryLocation); programArguments.add("-destination"); programArguments.add(Paths.get(destination + File.separator + profile).toString()); programArguments.add("-bundlepool"); programArguments.add(Paths.get(destination + File.separator + "lib").toString()); programArguments.add("-shared"); programArguments.add(Paths.get(destination + File.separator + "lib" + File.separator + "p2").toString()); programArguments.add("-profile"); programArguments.add(profile); programArguments.add("-profileProperties"); programArguments.add("org.eclipse.update.install.features=true"); programArguments.add("-roaming"); }

Target:
public void addArgumentsToInstallFeatures(String repositoryLocation, String destination, String profile) { programArguments.add(P2Constants.Launcher.METADATA_REPOSITORY); programArguments.add(repositoryLocation); programArguments.add(P2Constants.Launcher.ARTIFACT_REPOSITORY); programArguments.add(repositoryLocation); programArguments.add(P2Constants.Launcher.DESTINATION); programArguments.add(Paths.get(destination, profile).toString()); programArguments.add(P2Constants.Launcher.BUNDLEPOOL); programArguments.add(Paths.get(destination, P2Constants.LIB).toString()); programArguments.add(P2Constants.Launcher.SHARED); programArguments.add(Paths.get(destination, P2Constants.LIB, P2Constants.P2).toString()); programArguments.add(P2Constants.Launcher.PROFILE); programArguments.add(profile); programArguments.add(P2Constants.Launcher.PROFILE_PROPERTIES); programArguments.add(P2Constants.Launcher.ECLIPSE_UPDATE_FEATURE_TRUE); programArguments.add(P2Constants.Launcher.ROAMING); }
Source:
public void testJobStatuses() { MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHideJobs(false); view.save(); view.reloadConfiguration(); String strJobNotBuild = "simple-job-not-build"; String strBuildSuccess = "simple-job-success"; String strBuildFailed = "simple-job-failed"; FreeStyleJob jobNotBuild = jenkins.jobs.create(FreeStyleJob.class, strJobNotBuild); FreeStyleJob jobSuccess = jenkins.jobs.create(FreeStyleJob.class, strBuildSuccess); jobSuccess.startBuild().waitUntilFinished(); FreeStyleJob jobFailed = jenkins.jobs.create(FreeStyleJob.class, strBuildFailed); jobFailed.configure(); jobFailed.addShellStep("sh <"); jobFailed.save(); jobFailed.startBuild().waitUntilFinished(); view.open(); WebElement jobContainer = driver.findElement(By.id("jenkinsJobStatuses")); WebElement btnNotBuild = jobContainer.findElement(By.xpath(" assertThat(btnNotBuild.getAttribute("class"), containsString("invert-text-color")); WebElement btnBuildSuccess = jobContainer.findElement(By.xpath(" assertThat(btnBuildSuccess.getAttribute("class"), containsString("btn-success")); WebElement btnBuildFailed = jobContainer.findElement(By.xpath(" assertThat(btnBuildFailed.getAttribute("class"), containsString("btn-danger")); }

Target:
public void testJobStatuses() { MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view"); view.configure(); view.setHideBuildHistory(false); view.setHideJobs(false); view.save(); view.reloadConfiguration(); String strJobNotBuild = "simple-job-not-build"; String strBuildSuccess = "simple-job-success"; String strBuildFailed = "simple-job-failed"; FreeStyleJob jobNotBuild = jenkins.jobs.create(FreeStyleJob.class, strJobNotBuild); FreeStyleJob jobSuccess = jenkins.jobs.create(FreeStyleJob.class, strBuildSuccess); jobSuccess.startBuild().waitUntilFinished(); FreeStyleJob jobFailed = jenkins.jobs.create(FreeStyleJob.class, strBuildFailed); jobFailed.configure(); jobFailed.addShellStep("sh <"); jobFailed.save(); jobFailed.startBuild().waitUntilFinished(); view.open(); assertThat(view.getJobStatusArea().getStatusOfJob(strJobNotBuild), containsString("invert-text-color")); assertThat(view.getJobStatusArea().getStatusOfJob(strBuildSuccess), containsString("success")); assertThat(view.getJobStatusArea().getStatusOfJob(strBuildFailed), containsString("danger")); }
Source:
public boolean verify(JComponent jComponent) { if(jComponent instanceof JTextComponent) { String value = ((JTextField) jComponent).getText(); try { getValue(value); return true; } catch (ParseException ex) { LOGGER.error(I18N.tr("The entered value cannot be parsed"),ex); return false; } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); return false; } } else { throw new IllegalArgumentException("This verifier is only valid on Text field component"); } }

Target:
public boolean verify(JComponent jComponent) { if(jComponent instanceof JTextComponent) { String value = ((JTextComponent) jComponent).getText(); try { getValue(value); return true; } catch (ParseException ex) { LOGGER.error(I18N.tr("The entered value cannot be parsed"),ex); return false; } catch (Exception ex) { LOGGER.error(ex.getLocalizedMessage(),ex); return false; } } else { throw new IllegalArgumentException("This verifier is only valid on Text field component"); } }
Source:
public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOException { if (notExists()) { throw new FileNotFoundException("Can't find allure installation"); } if (Files.exists(reportPath)) { FileUtils.deleteDirectory(reportPath.toFile()); } CommandLine commandLine = new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); commandLine.addArgument("generate"); commandLine.addArgument("--clean"); for (Path resultsPath : resultsPaths) { commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); } commandLine.addArgument("-o"); commandLine.addArgument(reportPath.toAbsolutePath().toString(), true); DefaultExecutor executor = new DefaultExecutor(); ExecuteWatchdog watchdog = new ExecuteWatchdog(60000); executor.setWatchdog(watchdog); executor.setExitValue(0); return executor.execute(commandLine); }

Target:
public int generateReport(List<Path> resultsPaths, Path reportPath) throws IOException { this.checkAllureExists(); FileUtils.deleteQuietly(reportPath.toFile()); CommandLine commandLine = new CommandLine(getAllureExecutablePath().toAbsolutePath().toFile()); commandLine.addArgument("generate"); commandLine.addArgument("--clean"); for (Path resultsPath : resultsPaths) { commandLine.addArgument(resultsPath.toAbsolutePath().toString(), true); } commandLine.addArgument("-o"); commandLine.addArgument(reportPath.toAbsolutePath().toString(), true); return execute(commandLine); }
Source:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) throws OnmsTopologyException { if (!m_updatersMap.containsKey(updater.getProtocol())) { throw new OnmsTopologyException("cannot update message with id: " + message.getMessagebody().getId() + ". Protocol not supported", updater.getProtocol(), message.getMessagestatus()); } if ( m_updatersMap.get(updater.getProtocol()) != updater ) { throw new OnmsTopologyException("cannot update message with id: " + message.getMessagebody().getId() + ". updater not supported", updater.getProtocol(), message.getMessagestatus()); } synchronized (m_consumers) { m_consumers.stream(). filter(consumer -> consumer.getProtocols().contains(updater.getProtocol())). forEach(consumer -> consumer.consume(message)); } }

Target:
public void update(OnmsTopologyUpdater updater, OnmsTopologyMessage message) throws OnmsTopologyException { if (!m_updatersMap.containsKey(updater.getProtocol())) { throw new OnmsTopologyException(String.format("cannot update message with id: %s. Protocol not supported", message.getMessagebody().getId()), updater.getProtocol(), message.getMessagestatus()); } if ( m_updatersMap.get(updater.getProtocol()) != updater ) { throw new OnmsTopologyException(String.format("cannot update message with id: %s. Protocol not supported", message.getMessagebody().getId()), updater.getProtocol(), message.getMessagestatus()); } synchronized (m_consumers) { m_consumers.stream(). filter(consumer -> consumer.getProtocols().contains(updater.getProtocol())). forEach(consumer -> consumer.consume(message)); } }
Source:
public void function_star_args(){ setRootRule(PythonGrammar.TYPEDARGSLIST); assertThat(p).matches("*, foo=bar"); assertThat(p).matches("*args, boo"); assertThat(p).notMatches("*, boo"); assertThat(p).notMatches("*"); assertThat(p).notMatches("**"); }

Target:
public void function_star_args(){ setRootRule(PythonGrammar.TYPEDARGSLIST); assertThat(p).matches("*, foo=bar"); assertThat(p).matches("*args, boo"); assertThat(p).matches("p=42, ** kargs"); assertThat(p).matches("*, p, ** kargs"); assertThat(p).matches("*, boo"); assertThat(p).notMatches("p = 1, p2, *, ** kargs"); assertThat(p).notMatches("*"); assertThat(p).notMatches("**"); }
Source:
public void setup() { when(filterSettingsManager.createFilterSettingsPrototype()).thenReturn(filterSettingsMock); doNothing().when(savedFilterEvent).fire(any()); presenter = new AdvancedFiltersPresenter() { }; presenter.setFilterSettingsManager(filterSettingsManager); presenter.setAdvancedFilterEditorView(advancedFilterEditorView); presenter.setSavedFilterSelectedEvent(savedFilterEvent); }

Target:
public void setup() { when(filterSettingsManager.createFilterSettingsPrototype()).thenReturn(filterSettingsMock); doNothing().when(savedFilterEvent).fire(any()); doNothing().when(notificationEvent).fire(any()); presenter = spy(AdvancedFiltersPresenter.class); presenter.setFilterSettingsManager(filterSettingsManager); presenter.setAdvancedFilterEditorView(advancedFilterEditorView); presenter.setSavedFilterSelectedEvent(savedFilterEvent); presenter.setNotificationEvent(notificationEvent); presenter.setPlaceManager(placeManagerMock); }
Source:
static byte[] getHash(final ModelNode address) throws IOException { final ModelNode operation = new ModelNode(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(OP_ADDR).set(address); operation.get(NAME).set(CONTENT); final ModelNode result = executeOnMaster(operation); return executeOnMaster(operation).get(0).get("hash").asBytes(); }

Target:
static byte[] getHash(final ModelNode address) throws IOException { final ModelNode operation = new ModelNode(); operation.get(OP).set(READ_ATTRIBUTE_OPERATION); operation.get(OP_ADDR).set(address); operation.get(NAME).set(CONTENT); return executeOnMaster(operation).get(0).get("hash").asBytes(); }
Source:
public CompletableFuture<ClientResponse> run(byte[] jarfileBytes, String classesToDeleteSelector) { DrRoleType drRole = DrRoleType.fromValue(VoltDB.instance().getCatalogContext().getCluster().getDrrole()); boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema(); if (!allowPausedModeWork(false, isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if (!useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use @UpdateApplicationCatalog " + "to change application schema. Use of @UpdateClasses is forbidden."); } CatalogChangeResult ccr = null; try { ccr = prepareApplicationCatalogDiff("@UpdateClasses", jarfileBytes, classesToDeleteSelector, new String[0], null, false, drRole, useDDLSchema, false, getHostname(), getUsername()); } catch (PrepareDiffFailureException pe) { hostLog.info("A request to update the loaded classes has been rejected. More info returned to client."); return makeQuickResponse(pe.statusCode, pe.getMessage()); } if (ccr.upgradedFromVersion != null) { hostLog.info(String.format("In order to update the application catalog it was " + "automatically upgraded from version %s.", ccr.upgradedFromVersion)); } if (ccr.encodedDiffCommands.trim().length() == 0) { return makeQuickResponse(ClientResponseImpl.SUCCESS, "Catalog update with no changes was skipped."); } printCatalogUpdateLog("@UpdateClasses"); return callProcedure("@UpdateCore", ccr.encodedDiffCommands, ccr.catalogHash, ccr.catalogBytes, ccr.expectedCatalogVersion, ccr.deploymentString, ccr.tablesThatMustBeEmpty, ccr.reasonsForEmptyTables, ccr.requiresSnapshotIsolation ? 1 : 0, ccr.worksWithElastic ? 1 : 0, ccr.deploymentHash, ccr.requireCatalogDiffCmdsApplyToEE ? 1 : 0, ccr.hasSchemaChange ? 1 : 0, ccr.requiresNewExportGeneration ? 1 : 0); }

Target:
public CompletableFuture<ClientResponse> run(byte[] jarfileBytes, String classesToDeleteSelector) throws Exception { if (!allowPausedModeWork(false, isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema(); if (!useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use @UpdateApplicationCatalog " + "to change application schema. Use of @UpdateClasses is forbidden."); } logCatalogUpdateInvocation("@UpdateClasses"); return updateApplication("@UpdateClasses", jarfileBytes, classesToDeleteSelector, new String[0], null, false, useDDLSchema); }
Source:
public void addPageTerminalControl(ITerminalControl terminalControl) { fTerminalPageControls.add(terminalControl); if (fHistoryBuffer.size() > 0) { new WriteHistoryJob(terminalControl).schedule(); } }

Target:
public void addPageTerminalControl(ITerminalControl terminalControl) { if (fHistoryBuffer.size() > 0) { new WriteHistoryJob(terminalControl).schedule(); } fTerminalPageControls.add(terminalControl); }
Source:
public void setAddresses(String addresses) { if (StringUtils.hasText(addresses)) { Address[] addressArray = Address.parseAddresses(addresses); if (addressArray.length > 0) { if (addressArray.length == 1) { logger.warn("Cluster should have more than 1 host"); } this.addresses = addressArray; } } }

Target:
public void setAddresses(String addresses) { if (StringUtils.hasText(addresses)) { Address[] addressArray = Address.parseAddresses(addresses); if (addressArray.length > 0) { this.addresses = addressArray; return; } } logger.info("setAddresses() called with an empty value, will be using the host+port properties for connections"); this.addresses = null; }
Source:
private IconTheme.JabRefIcons getIcon(EntryType type) { if (StandardEntryType.Book.equals(type)) { return IconTheme.JabRefIcons.BOOK; } else if (Arrays.asList(StandardEntryType.InBook, StandardEntryType.InProceedings, StandardEntryType.InCollection).contains(type)) { return IconTheme.JabRefIcons.OPEN_LINK; } return IconTheme.JabRefIcons.ARTICLE; }

Target:
private IconTheme.JabRefIcons getIcon(EntryType type) { EnumSet<StandardEntryType> crossRefTypes = EnumSet.of(StandardEntryType.InBook, StandardEntryType.InProceedings, StandardEntryType.InCollection); if (type == StandardEntryType.Book) { return IconTheme.JabRefIcons.BOOK; } else if (crossRefTypes.contains(type)) { return IconTheme.JabRefIcons.OPEN_LINK; } return IconTheme.JabRefIcons.ARTICLE; }
Source:
public String getUsage() { StringBuilder help = new StringBuilder("Options:"); for(String arg : getUsageArguments()) { ParserArgument argument = this.arguments.get(arg); help.append( String.format( "%n --%-30s%-60s", arg + (argument.getType() != ArgumentType.no_argument ? "=[" + argument.getMetavar() + "]" : ""), argument.getHelp() ) ); } return String.format("%1$s%n%2$s%n%n%3$s%n%n%4$s", properties.getProperty( prefix + ".help.usage", (String)defaultProperties.get("help.usage") ), properties.getProperty( prefix + ".help.header", (String)defaultProperties.get("help.header") ), help.toString(), properties.getProperty( prefix + ".help.footer", (String)defaultProperties.get("help.footer") ) ); }

Target:
public String getUsage() { StringBuilder help = new StringBuilder(String.format("Options:%n")); for(String arg : getUsageArguments()) { ParserArgument argument = this.arguments.get(arg); help.append( String.format( " --%-30s%-60s%n", arg + (argument.getType() != ArgumentType.no_argument ? "=[" + argument.getMetavar() + "]" : ""), argument.getHelp() ) ); } return String.format("%1$s%n%2$s%n%n%3$s%n%4$s%n", properties.getProperty( prefix + ".help.usage", (String)defaultProperties.get("help.usage") ), properties.getProperty( prefix + ".help.header", (String) defaultProperties.get("help.header") ), help.toString(), properties.getProperty( prefix + ".help.footer", (String) defaultProperties.get("help.footer") ) ); }
Source:
public Map<?, ?> simpleSearch(String query, List<String> journalKeys, List<String> articleTypes, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, Map<String, String> rawQueryParams) throws IOException { List<NameValuePair> params = buildCommonParams(journalKeys, articleTypes, start, rows, sortOrder, dateRange, false, rawQueryParams); buildSimpleSearchQuery(params, query); return getRawResults(params); }

Target:
public Map<?, ?> simpleSearch(String query, List<String> journalKeys, List<String> articleTypes, int start, int rows, SearchCriterion sortOrder, SearchCriterion dateRange, Map<String, String> rawQueryParams) throws IOException { List<NameValuePair> params = buildCommonParams(query, true, start, rows, sortOrder, false, rawQueryParams); setQueryFilters(params, journalKeys, articleTypes, new ArrayList<String>(), dateRange); return getRawResults(params); }
Source:
public int getHeigth() { return (int) settings.getDouble("SCREEN_HEIGHT") - 50; }

Target:
public double getHeigth() { return settings.getDouble("SCREEN_HEIGHT") - 50; }
Source:
public FetchHintsBuilder parse(JSONObject fetchHintsJson) { if (fetchHintsJson != null) { this.includeAllProperties = fetchHintsJson.optBoolean("includeAllProperties", false); this.includeAllPropertyMetadata = fetchHintsJson.optBoolean("includeAllPropertyMetadata", false); this.includeHidden = fetchHintsJson.optBoolean("includeHidden", false); this.includeAllEdgeRefs = fetchHintsJson.optBoolean("includeAllEdgeRefs", false); this.includeOutEdgeRefs = fetchHintsJson.optBoolean("includeOutEdgeRefs", false); this.includeInEdgeRefs = fetchHintsJson.optBoolean("includeInEdgeRefs", false); this.includeEdgeLabelsAndCounts = fetchHintsJson.optBoolean("includeEdgeLabelsAndCounts", false); this.includeExtendedDataTableNames = fetchHintsJson.optBoolean("includeExtendedDataTableNames", false); if (fetchHintsJson.has("propertyNamesToInclude")) { this.propertyNamesToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("propertyNamesToInclude")); } if (fetchHintsJson.has("metadataKeysToInclude")) { this.metadataKeysToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("metadataKeysToInclude")); } if (fetchHintsJson.has("edgeLabelsOfEdgeRefsToInclude")) { this.edgeLabelsOfEdgeRefsToInclude = jsonArrayToSet(fetchHintsJson.getJSONArray("edgeLabelsOfEdgeRefsToInclude")); } } return this; }

Target:
public static FetchHintsBuilder parse(JSONObject fetchHintsJson) { if (fetchHintsJson == null) { fetchHintsJson = new JSONObject(); } return new FetchHintsBuilder() .setIncludeAllProperties(fetchHintsJson.optBoolean("includeAllProperties", false)) .setIncludeAllPropertyMetadata(fetchHintsJson.optBoolean("includeAllPropertyMetadata", false)) .setIncludeHidden(fetchHintsJson.optBoolean("includeHidden", false)) .setIncludeAllEdgeRefs(fetchHintsJson.optBoolean("includeAllEdgeRefs", false)) .setIncludeOutEdgeRefs(fetchHintsJson.optBoolean("includeOutEdgeRefs", false)) .setIncludeInEdgeRefs(fetchHintsJson.optBoolean("includeInEdgeRefs", false)) .setIncludeEdgeLabelsAndCounts(fetchHintsJson.optBoolean("includeEdgeLabelsAndCounts", false)) .setIncludeExtendedDataTableNames(fetchHintsJson.optBoolean("includeExtendedDataTableNames", false)) .setPropertyNamesToInclude(fetchHintsJson.has("propertyNamesToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("propertyNamesToInclude")) : null) .setMetadataKeysToInclude(fetchHintsJson.has("metadataKeysToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("metadataKeysToInclude")) : null) .setEdgeLabelsOfEdgeRefsToInclude(fetchHintsJson.has("edgeLabelsOfEdgeRefsToInclude") ? jsonArrayToSet(fetchHintsJson.getJSONArray("edgeLabelsOfEdgeRefsToInclude")) : null); }
Source:
public String testTransaction(int transactionCount, int timeoutCount) throws RemoteException, NamingException { TxTestUtil.checkTransactionExists(tm, false); for(int i = 1; i <= transactionCount; i++) { boolean isTimeout = (timeoutCount - i >= 0) ? true : false; runTransaction(isTimeout); } try { return TxTestUtil.getStatusAsString(txn.getStatus()); } catch (SystemException se) { throw new EJBException("Can't get status of transaction", se); } }

Target:
public String testTransaction(int transactionCount, int timeoutCount) throws RemoteException, NamingException, SystemException { TxTestUtil.checkTransactionExists(tm, false); for(int i = 1; i <= transactionCount; i++) { boolean isTimeout = (i <= timeoutCount); runTransaction(isTimeout); } return TxTestUtil.getStatusAsString(txn.getStatus()); }
Source:
public boolean serviceCheck(String name, int code, String hostname, JSONArray tags) { logger.fine(String.format("Sending service check '%s' with status %s", name, code)); JSONObject payload = new JSONObject(); payload.put("check", name); payload.put("host_name", hostname); payload.put("timestamp", System.currentTimeMillis() / 1000); payload.put("status", code); if (tags != null) { logger.fine(tags.toString()); payload.put("tags", tags); } boolean status; try { status = post(payload, SERVICECHECK); } catch (Exception e) { logger.severe(e.toString()); status = false; } return status; }

Target:
public boolean serviceCheck(String name, int code, String hostname, JSONArray tags) { logger.fine(String.format("Sending service check '%s' with status %s", name, code)); JSONObject payload = new JSONObject(); payload.put("check", name); payload.put("host_name", hostname); payload.put("timestamp", System.currentTimeMillis() / 1000); payload.put("status", code); if (tags != null) { logger.fine(tags.toString()); payload.put("tags", tags); } return post(payload, SERVICECHECK); }
Source:
private void checkRetentionTime(final Errors errors, final EventTypeOptions options) { final Long retentionTime = options.getRetentionTime(); if (retentionTime == null) { options.setRetentionTime(defaultTopicRetentionMs); return; } if (retentionTime > maxTopicRetentionMs) { createError(errors, "can not be more than " + maxTopicRetentionMs); } else if (retentionTime < minTopicRetentionMs) { createError(errors, "can not be less than " + minTopicRetentionMs); } }

Target:
private void checkRetentionTime(final Errors errors, final EventTypeOptions options) { final Long retentionTime = options.getRetentionTime(); if (retentionTime != null) { if (retentionTime > maxTopicRetentionMs) { createError(errors, "can not be more than " + maxTopicRetentionMs); } else if (retentionTime < minTopicRetentionMs) { createError(errors, "can not be less than " + minTopicRetentionMs); } } }
Source:
public ConcurrentMap<String, String> getSymbols() { return symbols; }

Target:
public Map<String, String> getSymbols() { return symbols; }
Source:
public static <T extends @NonNull Enum<T>> getEnum() { return null; }

Target:
public static <T extends @NonNull Enum<T>> T getEnum() { return null; }
Source:
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); R request = getRequest(); Object attribute = getRequestAttribute(getRequest(), CONVERSATIONS_ATTRIBUTE_NAME); if (attribute == null || !(attribute instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, attribute, request); } return cast(attribute); }

Target:
private Map<String, ManagedConversation> getConversationMap() { checkIsAssociated(); checkContextInitialized(); R request = getRequest(); Object attribute = getRequestAttribute(request, CONVERSATIONS_ATTRIBUTE_NAME); if (attribute == null || !(attribute instanceof Map)) { throw ConversationLogger.LOG.unableToLoadConversations(CONVERSATIONS_ATTRIBUTE_NAME, attribute, request); } return cast(attribute); }
Source:
public JacksonAdapter() { simpleMapper = initializeObjectMapper(new ObjectMapper()); xmlMapper = initializeObjectMapper(new XmlMapper()); xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); xmlMapper.setDefaultUseWrapper(false); ObjectMapper flatteningMapper = initializeObjectMapper(new ObjectMapper()) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); mapper = initializeObjectMapper(new ObjectMapper()) .registerModule(AdditionalPropertiesSerializer.getModule(flatteningMapper)) .registerModule(AdditionalPropertiesDeserializer.getModule(flatteningMapper)) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); headerMapper = initializeHeaderMapper(new ObjectMapper()); }

Target:
public JacksonAdapter() { simpleMapper = initializeObjectMapper(new ObjectMapper()); xmlMapper = initializeObjectMapper(new XmlMapper()); xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); xmlMapper.setDefaultUseWrapper(false); ObjectMapper flatteningMapper = initializeObjectMapper(new ObjectMapper()) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); mapper = initializeObjectMapper(new ObjectMapper()) .registerModule(AdditionalPropertiesSerializer.getModule(flatteningMapper)) .registerModule(AdditionalPropertiesDeserializer.getModule(flatteningMapper)) .registerModule(FlatteningSerializer.getModule(simpleMapper())) .registerModule(FlatteningDeserializer.getModule(simpleMapper())); headerMapper = simpleMapper .copy() .configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); }
Source:
public CaseFileDataLogDeleteBuilderImpl inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { return (CaseFileDataLogDeleteBuilderImpl) this; } this.caseDefId = caseDefId; return (CaseFileDataLogDeleteBuilderImpl) this; }

Target:
public CaseFileDataLogDeleteBuilder inCaseDefId(String caseDefId) { if (checkIfNull(caseDefId)) { return this; } this.caseDefId = caseDefId; return this; }
Source:
public ConlluSentence read() throws IOException { String sentence = sentenceStream.read(); if (sentence != null) { List<ConlluWordLine> wordLines = new ArrayList<>(); BufferedReader reader = new BufferedReader(new StringReader(sentence)); String line; while ((line = reader.readLine()) != null) { if (line.trim().startsWith("#")) { continue; } wordLines.add(new ConlluWordLine(line)); } return new ConlluSentence(wordLines); } return null; }

Target:
public ConlluSentence read() throws IOException { String sentence = sentenceStream.read(); if (sentence != null) { List<ConlluWordLine> wordLines = new ArrayList<>(); BufferedReader reader = new BufferedReader(new StringReader(sentence)); String line; while ((line = reader.readLine()) != null) { if (!line.trim().startsWith("#")) { wordLines.add(new ConlluWordLine(line)); } } return new ConlluSentence(wordLines); } return null; }
Source:
public void setUp() throws Exception { super.setUp(); dao = prepareDAO(dbFacade.getStorageServerConnectionDao()); existingConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c297f"); existingNfsAutoConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c2981"); newServerConnection = new storage_server_connections(); newServerConnection.setid("0cc146e8-e5ed-482c-8814-270bc48c2980"); newServerConnection.setconnection(EXISTING_DOMAIN_STORAGE_NAME); }

Target:
public void setUp() throws Exception { super.setUp(); dao = prepareDAO(dbFacade.getStorageServerConnectionDao()); existingConnection = dao.get("0cc146e8-e5ed-482c-8814-270bc48c297f"); existingNfsAutoConnection = dao.get(FixturesTool.EXISTING_STORAGE_CONNECTION_NFS_AUTO_ID.toString()); newServerConnection = new storage_server_connections(); newServerConnection.setid("0cc146e8-e5ed-482c-8814-270bc48c2980"); newServerConnection.setconnection(EXISTING_DOMAIN_STORAGE_NAME); }
Source:
protected void implementationSpecificPut(List<Metric> metrics, Set<String> scopeNames) { SystemAssert.requireArgument(metrics != null, "Metrics list cannot be null."); SystemAssert.requireArgument(scopeNames != null, "Scope names list cannot be null."); _logger.info("{} new metrics need to be indexed on ES.", metrics.size()); long start = System.currentTimeMillis(); List<List<MetricSchemaRecord>> fracturedList = _fracture(metrics); for(List<MetricSchemaRecord> records : fracturedList) { if(!records.isEmpty()) { _upsert(records); } } int count = 0; for(List<MetricSchemaRecord> records : fracturedList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITE_LATENCY, (System.currentTimeMillis() - start), null); _logger.info("{} new scopes need to be indexed on ES.", scopeNames.size()); start = System.currentTimeMillis(); List<List<ScopeOnlySchemaRecord>> fracturedScopesList = _fractureScopes(scopeNames); for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { if(!records.isEmpty()) { _upsertScopes(records); } } count = 0; for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITE_LATENCY, (System.currentTimeMillis() - start), null); }

Target:
protected void implementationSpecificPut(List<Metric> metrics, Set<String> scopeNames) { SystemAssert.requireArgument(metrics != null, "Metrics list cannot be null."); SystemAssert.requireArgument(scopeNames != null, "Scope names set cannot be null."); _logger.info("{} new metrics need to be indexed on ES.", metrics.size()); long start = System.currentTimeMillis(); List<List<MetricSchemaRecord>> fracturedList = _fracture(metrics); for(List<MetricSchemaRecord> records : fracturedList) { if(!records.isEmpty()) { _upsert(records); } } int count = 0; for(List<MetricSchemaRecord> records : fracturedList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCHEMARECORDS_WRITE_LATENCY, (System.currentTimeMillis() - start), null); _logger.info("{} new scopes need to be indexed on ES.", scopeNames.size()); start = System.currentTimeMillis(); List<List<ScopeOnlySchemaRecord>> fracturedScopesList = _fractureScopes(scopeNames); for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { if(!records.isEmpty()) { _upsertScopes(records); } } count = 0; for(List<ScopeOnlySchemaRecord> records : fracturedScopesList) { count += records.size(); } _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITTEN, count, null); _monitorService.modifyCounter(MonitorService.Counter.SCOPENAMES_WRITE_LATENCY, (System.currentTimeMillis() - start), null); }
Source:
public void run() { IterableStream<ServiceBusReceivedMessageContext> messages = receiver .receiveMessages(options.getMessagesToReceive()); for (ServiceBusReceivedMessageContext messageContext : messages) { receiver.complete(messageContext.getMessage().getLockToken()); } }

Target:
public void run() { IterableStream<ServiceBusReceivedMessage> messages = receiver .receiveMessages(options.getMessagesToReceive()); int count = 0; for (ServiceBusReceivedMessage message : messages) { receiver.complete(message); ++count; } if (count <= 0) { throw logger.logExceptionAsWarning(new RuntimeException("Error. Should have received some messages.")); } }
Source:
public void doChangeAbandonedHook(final Change change, final Account account, final String reason) { final ChangeAbandonedEvent event = new ChangeAbandonedEvent(); event.project = change.getProject().get(); event.branch = change.getDest().getShortName(); event.change = change.getKey().get(); event.author = getAuthorAttribute(account); event.reason = reason; for (ChangeListenerHolder holder : listeners.values()) { if (isVisibleTo(change, holder.user)) { holder.listener.onChangeEvent(event); } } final List<String> args = new ArrayList<String>(); args.add(changeAbandonedHook.getAbsolutePath()); args.add("--change"); args.add(event.change); args.add("--project"); args.add(event.project); args.add("--branch"); args.add(event.branch); args.add("--abandoner"); args.add(getDisplayName(account)); args.add("--reason"); args.add(reason == null ? "" : reason); runHook(getRepo(change), args); }

Target:
public void doChangeAbandonedHook(final Change change, final Account account, final String reason) { final ChangeAbandonedEvent event = new ChangeAbandonedEvent(); event.project = change.getProject().get(); event.branch = change.getDest().getShortName(); event.change = change.getKey().get(); event.author = getAuthorAttribute(account); event.reason = reason; fireEvent(change, event); final List<String> args = new ArrayList<String>(); args.add(changeAbandonedHook.getAbsolutePath()); args.add("--change"); args.add(event.change); args.add("--project"); args.add(event.project); args.add("--branch"); args.add(event.branch); args.add("--abandoner"); args.add(getDisplayName(account)); args.add("--reason"); args.add(reason == null ? "" : reason); runHook(getRepo(change), args); }
Source:
private void createSupplementaryDirectory() { IFolder supplFolder = getTraceSupplementaryFolder(getResourceName()); if (!supplFolder.exists()) { try { supplFolder.create(true, true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError("Error creating resource supplementary file " + supplFolder, e); } } try { fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath()); } catch (CoreException e) { Activator.getDefault().logError("Error setting persistant property " + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); } }

Target:
private void createSupplementaryDirectory() { IFolder supplFolder = getTraceSupplementaryFolder(getResourceName()); if (!supplFolder.exists()) { try { supplFolder.create(true, true, new NullProgressMonitor()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorCreateSuppRes + supplFolder, e); } } try { fResource.setPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, supplFolder.getLocationURI().getPath()); } catch (CoreException e) { Activator.getDefault().logError(Messages.TmfCommonProjectElement_ErrorSettingProperty + TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER, e); } }
Source:
public boolean hasMatchingUniqueConstraint(final Item item, final String propertyName, final String propertyValue) { final Class<? extends Item> itemClass = item.getClass(); final String tableName = getItemTableName(itemClass); final Map<String, ItemId> uniqueConstraintsForProperty = uniqueConstraints.get(newUniqueConstraintKey( tableName, propertyName)); final ItemId itemId = getItemId(item); for (final Entry<String, ItemId> entry : uniqueConstraintsForProperty.entrySet()) { if (entry.getValue().equals(itemId)) { return entry.getKey().equals(propertyValue.toUpperCase()); } } return false; }

Target:
boolean hasMatchingUniqueConstraint(final Item item, final String propertyName, final String propertyValue) { final Class<? extends Item> itemClass = item.getClass(); final String tableName = getItemTableName(itemClass); final Map<String, ItemId> uniqueConstraintsForProperty = uniqueConstraints.get(newUniqueConstraintKey( tableName, propertyName)); final ItemId itemId = getItemId(item); for (final Entry<String, ItemId> entry : uniqueConstraintsForProperty.entrySet()) { if (entry.getValue().equals(itemId)) { return entry.getKey().equals(propertyValue.toUpperCase()); } } return false; }
Source:
protected TokenManager getLexerForSource(SourceCode sourceCode) { return new VfTokenManager(new CharSequenceReader(sourceCode.getCodeBuffer())); }

Target:
protected TokenManager getLexerForSource(SourceCode sourceCode) { return new VfTokenManager(IOUtil.skipBOM(new CharSequenceReader(sourceCode.getCodeBuffer()))); }
Source:
public static ServerWebExchangeMatcher anyExchange() { return exchange -> ServerWebExchangeMatcher.MatchResult.match(); }

Target:
public static ServerWebExchangeMatcher anyExchange() { return new ServerWebExchangeMatcher() { @Override public Mono<MatchResult> matches(ServerWebExchange exchange) { return ServerWebExchangeMatcher.MatchResult.match(); } }; }
Source:
private Map<Site, Pattern> getFromConfig(Site site) { List<Map<String, String>> patternMaps = (List<Map<String, String>>) site.getTheme() .getConfigMap("journalDoiRegex").get("regexList"); String journalKey = site.getJournalKey(); for (Map<String, String> patternMap : patternMaps) { String journalKeyFromConfig = patternMap.values().iterator().next(); if (journalKey.equals(journalKeyFromConfig)) { putIntoCache(site, Pattern.compile(patternMap.get("pattern"))); return getFromCache(site); } } return null; }

Target:
private ImmutableList<DoiJournalRegex> getFromConfig(Site site) { List<Map<String, String>> patternMaps = (List<Map<String, String>>) site.getTheme() .getConfigMap("journalDoiRegex").get("regexList"); List<DoiJournalRegex> regices = patternMaps.stream().map(regexMap -> { String journalKey = regexMap.get("journalKey"); String pattern = regexMap.get("pattern"); return new DoiJournalRegex(journalKey, Pattern.compile(pattern)); }).collect(Collectors.toList()); return ImmutableList.copyOf(regices); }
Source:
public void testDisableRule() { SonarLintGlobalSettings settings = new SonarLintGlobalSettings(); settings.disableRule(RULE); assertThat(settings.isRuleActive(RULE)).isEqualTo(false); }

Target:
public void testDisableRule() { SonarLintGlobalSettings settings = new SonarLintGlobalSettings(); settings.disableRule(RULE); assertThat(settings.isRuleExplicitlyDisabled(RULE)).isTrue(); }
Source:
public CommandExecutorQueueProvider(@GerritServerConfig final Config config, final WorkQueue queues) { final int cores = Runtime.getRuntime().availableProcessors(); poolSize = config.getInt("sshd", "threads", 3 * cores / 2); int interactiveThreads = config.getInt("sshd", "interactive", (int) (0.75f * poolSize)); int batchThreads = poolSize - interactiveThreads; interactiveExecutor = queues.createQueue(interactiveThreads, "SSH-Worker"); batchExecutor = queues.createQueue(batchThreads, "SSH-Batch-Worker"); setThreadFactory(interactiveExecutor); setThreadFactory(batchExecutor); }

Target:
public CommandExecutorQueueProvider(@GerritServerConfig final Config config, final WorkQueue queues) { final int cores = Runtime.getRuntime().availableProcessors(); poolSize = config.getInt("sshd", "threads", 3 * cores / 2); batchThreads = config.getInt("sshd", "batchThreads", 0); if (batchThreads > poolSize) { poolSize += batchThreads; } int interactiveThreads = Math.max(1, poolSize - batchThreads); interactiveExecutor = queues.createQueue(interactiveThreads, "SSH-Interactive-Worker"); if (batchThreads != 0) { batchExecutor = queues.createQueue(batchThreads, "SSH-Batch-Worker"); setThreadFactory(batchExecutor); } else { batchExecutor = interactiveExecutor; } setThreadFactory(interactiveExecutor); }
Source:
public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated: {0}", configuration.getSourceRoot()); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } if (isAuthorizationWatchdog() && config.getPluginDirectory() != null) { startWatchDogService(new File(config.getPluginDirectory())); } else { stopWatchDogService(); } getAuthorizationFramework().setPluginDirectory(config.getPluginDirectory()); getAuthorizationFramework().setStack(config.getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(config.getMessageLimit()); SuggesterServiceImpl.getInstance().refresh(configuration); }

Target:
public void applyConfig(Configuration config, boolean reindex, boolean interactive) { setConfiguration(config, interactive); LOGGER.log(Level.INFO, "Configuration updated: {0}", configuration.getSourceRoot()); if (reindex) { refreshSearcherManagerMap(); maybeRefreshIndexSearchers(); refreshDateForLastIndexRun(); } if (isAuthorizationWatchdog() && config.getPluginDirectory() != null) { startWatchDogService(new File(config.getPluginDirectory())); } else { stopWatchDogService(); } getAuthorizationFramework().setPluginDirectory(config.getPluginDirectory()); getAuthorizationFramework().setStack(config.getPluginStack()); getAuthorizationFramework().reload(); messagesContainer.setMessageLimit(config.getMessageLimit()); }
Source:
public static ParameterizedTypeName get( ClassName rawType, Iterable<? extends TypeName> typeArguments) { ArrayList<TypeName> typeArgumentsList = new ArrayList<>(); for (TypeName typeArgument : typeArguments) { typeArgumentsList.add(typeArgument); } return get(rawType, typeArgumentsList.toArray(new TypeName[0])); }

Target:
public static ParameterizedTypeName get( ClassName rawType, Iterable<? extends TypeName> typeArguments) { ArrayList<TypeName> typeArgumentsList = new ArrayList<>(); for (TypeName typeArgument : typeArguments) { typeArgumentsList.add(typeArgument); } return new ParameterizedTypeName(null, rawType, typeArgumentsList); }
Source:
public void initWithNiwsConfig(IClientConfig clientConfig) { super.initWithNiwsConfig(clientConfig); serverWeightTaskTimerInterval = Integer.parseInt( String.valueOf(clientConfig.getProperty(WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY, DEFAULT_TIMER_INTERVAL))); }

Target:
public void initWithNiwsConfig(IClientConfig clientConfig) { super.initWithNiwsConfig(clientConfig); serverWeightTaskTimerInterval = clientConfig.get(WEIGHT_TASK_TIMER_INTERVAL_CONFIG_KEY, DEFAULT_TIMER_INTERVAL); }
Source:
public Void visitJoin(JoinNode node, Integer indent) { List<Expression> joinExpressions = new ArrayList<>(); for (JoinNode.EquiJoinClause clause : node.getCriteria()) { joinExpressions.add(clause.toExpression()); } node.getFilter().ifPresent(expression -> joinExpressions.add(expression)); if (node.isSpatialJoin()) { print(indent, "- SpatialJoin[%s] => [%s]", Joiner.on(" AND ").join(joinExpressions), formatOutputs(node.getOutputSymbols())); } else if (node.isCrossJoin()) { print(indent, "- CrossJoin[%s] => [%s]", Joiner.on(" AND ").join(joinExpressions), formatOutputs(node.getOutputSymbols())); } else { print(indent, "- %s[%s]%s => [%s]", node.getType().getJoinLabel(), Joiner.on(" AND ").join(joinExpressions), formatHash(node.getLeftHashSymbol(), node.getRightHashSymbol()), formatOutputs(node.getOutputSymbols())); } node.getDistributionType().ifPresent(distributionType -> print(indent + 2, "Distribution: %s", distributionType)); node.getSortExpressionContext().ifPresent(context -> print(indent + 2, "SortExpression[%s]", context.getSortExpression())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); node.getLeft().accept(this, indent + 1); node.getRight().accept(this, indent + 1); return null; }

Target:
public Void visitJoin(JoinNode node, Integer indent) { List<Expression> joinExpressions = new ArrayList<>(); for (JoinNode.EquiJoinClause clause : node.getCriteria()) { joinExpressions.add(clause.toExpression()); } node.getFilter().ifPresent(expression -> joinExpressions.add(expression)); if (node.isSpatialJoin()) { print(indent, "- SpatialJoin[%s] => [%s]", Joiner.on(" AND ").join(joinExpressions), formatOutputs(node.getOutputSymbols())); } else if (node.isCrossJoin()) { checkState(joinExpressions.isEmpty()); print(indent, "- CrossJoin => [%s]", formatOutputs(node.getOutputSymbols())); } else { print(indent, "- %s[%s]%s => [%s]", node.getType().getJoinLabel(), Joiner.on(" AND ").join(joinExpressions), formatHash(node.getLeftHashSymbol(), node.getRightHashSymbol()), formatOutputs(node.getOutputSymbols())); } node.getDistributionType().ifPresent(distributionType -> print(indent + 2, "Distribution: %s", distributionType)); node.getSortExpressionContext().ifPresent(context -> print(indent + 2, "SortExpression[%s]", context.getSortExpression())); printPlanNodesStatsAndCost(indent + 2, node); printStats(indent + 2, node.getId()); node.getLeft().accept(this, indent + 1); node.getRight().accept(this, indent + 1); return null; }
Source:
public Cipher(String key) { if (!isValidKey(key)) { throw new IllegalArgumentException("Bad key"); } this.key = key; }

Target:
public Cipher(String key) { if (!isValidKey(key)) { throw new IllegalArgumentException("Invalid key"); } this.key = key; }
Source:
private int handleExceptions(Exception e, String url, String method) { if (logEnabled) { System.out.println(new StringBuilder(method).append(" Request: ").append(url).append(" | ") .append(e.getClass().getName()).append(" occured | Error message: ") .append(e.getMessage()).toString()); } if (e instanceof ClientProtocolException) { return 400; } return 500; }

Target:
private int handleExceptions(Exception e, String url, String method) { if (logEnabled) { System.err.println(new StringBuilder(method).append(" Request: ").append(url).append(" | ") .append(e.getClass().getName()).append(" occured | Error message: ") .append(e.getMessage()).toString()); } if (e instanceof ClientProtocolException) { return 400; } return 500; }