auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public FeatureFlagBuilder(String key) { this.key = key; }

Target:
FeatureFlagBuilder(String key) { this.key = key; }
Source:
private int getFlags() { int flags = 0; if (actionArgs.containsKey("flags")) { for (String f : (List<String>)actionArgs.get("flags")) { if(f.equals("resolve-groups")) { flags += 1; } else if (f.equals("resolve-groups-recursive")) { flags += 2; } } } return flags; }

Target:
private int getFlags() { int flags = 0; if (actionArgs.containsKey("flags")) { for (String f : (List<String>)actionArgs.get("flags")) { try { flags |= Authz.QueryFlags.class.getDeclaredField(f.toUpperCase().replace("-", "_")).getInt(new Authz.QueryFlags()); } catch(NoSuchFieldException | IllegalAccessException ex) { logger.error("Flag '{}' was not recognized, it will be ignored.", f); } } } return flags; }
Source:
public Double getValue() { return value; }

Target:
public Double getValue() { return this.value; }
Source:
protected HttpClient getHttpClient(Integer readTimeout, Integer connectTimeout) { if (getDoCacheClient() && HTTP_CLIENT_API_43) { if (cachedClient != null) { return cachedClient; } else { getNewPooledHttpClient(readTimeout, connectTimeout); } } if (HTTP_CLIENT_API_43) { RequestConfig config = RequestConfig.custom() .setSocketTimeout(readTimeout) .setConnectTimeout(connectTimeout) .setConnectionRequestTimeout(connectTimeout) .build(); HttpClientBuilder clientBuilder = HttpClientBuilder.create() .setDefaultRequestConfig(config); HttpClient httpClient = clientBuilder.build(); return httpClient; } else { DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, readTimeout); httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeout); return httpClient; } }

Target:
protected HttpClient getHttpClient(Integer readTimeout, Integer connectTimeout) { if (getDoCacheClient() && HTTP_CLIENT_API_43) { if (cachedClient == null) { cachedClient = getNewPooledHttpClient(readTimeout, connectTimeout); } return cachedClient; } if (HTTP_CLIENT_API_43) { RequestConfig config = RequestConfig.custom() .setSocketTimeout(readTimeout) .setConnectTimeout(connectTimeout) .setConnectionRequestTimeout(connectTimeout) .build(); HttpClientBuilder clientBuilder = HttpClientBuilder.create() .setDefaultRequestConfig(config); HttpClient httpClient = clientBuilder.build(); return httpClient; } else { DefaultHttpClient httpClient = new DefaultHttpClient(); httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, readTimeout); httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, connectTimeout); return httpClient; } }
Source:
private MistTask(final QueryManager queryManager, final CheckpointManager checkpointManager, @Parameter(TaskId.class) final String taskId, @Parameter(TaskHostname.class) final String taskHostname, @Parameter(MasterHostname.class) final String masterHostname, @Parameter(TaskToMasterPort.class) final int taskToMasterPort, final MasterToTaskMessage masterToTaskMessage, final ClientToTaskMessage clientToTaskMessage, final TcpPortProvider tcpPortProvider) throws InjectionException, IOException, InterruptedException { this.countDownLatch = new CountDownLatch(1); this.queryManager = queryManager; final Iterator<Integer> portNumIterator = tcpPortProvider.iterator(); clientToTaskServer = setupRandomPortAvroServer(ClientToTaskMessage.class, clientToTaskMessage, tcpPortProvider); LOG.log(Level.INFO, "Client to task port = " + clientToTaskServer.getPort()); masterToTaskServer = setupRandomPortAvroServer(MasterToTaskMessage.class, masterToTaskMessage, tcpPortProvider); LOG.log(Level.INFO, "Master to task port = " + masterToTaskServer.getPort()); final TaskToMasterMessage proxyToMaster = AvroUtils.createAvroProxy(TaskToMasterMessage.class, new InetSocketAddress(masterHostname, taskToMasterPort)); final TaskInfo taskInfo = TaskInfo.newBuilder() .setTaskId(taskId) .setTaskHostname(taskHostname) .setClientToTaskPort(clientToTaskServer.getPort()) .setMasterToTaskPort(masterToTaskServer.getPort()) .build(); final Thread t = new Thread(new RegisterTaskInfoRunner(proxyToMaster, taskInfo)); t.start(); t.join(); this.checkpointManager = checkpointManager; }

Target:
private MistTask(final QueryManager queryManager, final CheckpointManager checkpointManager, @Parameter(TaskId.class) final String taskId, @Parameter(TaskHostname.class) final String taskHostname, @Parameter(MasterHostname.class) final String masterHostname, @Parameter(TaskToMasterPort.class) final int taskToMasterPort, final MasterToTaskMessage masterToTaskMessage, final ClientToTaskMessage clientToTaskMessage, final TcpPortProvider tcpPortProvider) throws InjectionException, IOException, InterruptedException { this.countDownLatch = new CountDownLatch(1); this.queryManager = queryManager; clientToTaskServer = setupRandomPortAvroServer(ClientToTaskMessage.class, clientToTaskMessage, tcpPortProvider); LOG.log(Level.INFO, "Client to task port = " + clientToTaskServer.getPort()); masterToTaskServer = setupRandomPortAvroServer(MasterToTaskMessage.class, masterToTaskMessage, tcpPortProvider); LOG.log(Level.INFO, "Master to task port = " + masterToTaskServer.getPort()); final TaskToMasterMessage proxyToMaster = AvroUtils.createAvroProxy(TaskToMasterMessage.class, new InetSocketAddress(masterHostname, taskToMasterPort)); final TaskInfo taskInfo = TaskInfo.newBuilder() .setTaskId(taskId) .setTaskHostname(taskHostname) .setClientToTaskPort(clientToTaskServer.getPort()) .setMasterToTaskPort(masterToTaskServer.getPort()) .build(); final Thread t = new Thread(new RegisterTaskInfoRunner(proxyToMaster, taskInfo)); t.start(); t.join(); this.checkpointManager = checkpointManager; }
Source:
protected boolean advance() { this.nextRecord = null; while (this.nextRecord == null && (this.bufferedRecords.hasNext() || bufferNextChunkOfRecords(getTargetProportion(), this.targetAccuracy))) { final SAMRecord rec = this.bufferedRecords.next(); final String key = rec.getReadName(); final Boolean previous = decisions.get(key); final boolean keeper; if (previous == null) { keeper = this.bufferedRecordsToKeep.contains(rec.getReadName()); decisions.put(key, keeper); } else { keeper = previous; } if (keeper) { this.nextRecord = rec; recordAcceptedRecord(rec); } else { recordDiscardedRecord(rec); } } return this.nextRecord != null; }

Target:
protected boolean advance() { this.nextRecord = null; while (this.nextRecord == null && (this.bufferedRecords.hasNext() || bufferNextChunkOfRecords(getTargetProportion(), this.targetAccuracy))) { final SAMRecord rec = this.bufferedRecords.next(); final String key = rec.getReadName(); final Boolean previous = decisions.get(key); final boolean keepThisRecord; if (previous == null) { keepThisRecord = this.bufferedRecordsToKeep.contains(rec.getReadName()); decisions.put(key, keepThisRecord); } else { keepThisRecord = previous; } if (keepThisRecord) { this.nextRecord = rec; recordAcceptedRecord(); } else { recordDiscardedRecord(); } } return this.nextRecord != null; }
Source:
public void handleMessage(Message msg) { AsyncResult ar; if (mDestroyed.get()) { Rlog.e(LOG_TAG, "Received message " + msg + "[" + msg.what + "] while being destroyed. Ignoring."); return; } loge("IsimUiccRecords: handleMessage " + msg + "[" + msg.what + "] "); try { switch (msg.what) { case EVENT_APP_READY: onReady(); break; case EVENT_ISIM_REFRESH: broadcastRefresh(); break; case EVENT_ISIM_AUTHENTICATE_DONE: ar = (AsyncResult)msg.obj; log("EVENT_ISIM_AUTHENTICATE_DONE"); if (ar.exception != null) { log("Exception ISIM AKA: " + ar.exception); } else { try { auth_rsp = (String)ar.result; log("ISIM AKA: auth_rsp = " + auth_rsp); } catch (Exception e) { log("Failed to parse ISIM AKA contents: " + e); } } synchronized (mLock) { mLock.notifyAll(); } break; default: super.handleMessage(msg); } } catch (RuntimeException exc) { Rlog.w(LOG_TAG, "Exception parsing SIM record", exc); } }

Target:
public void handleMessage(Message msg) { AsyncResult ar; if (mDestroyed.get()) { Rlog.e(LOG_TAG, "Received message " + msg + "[" + msg.what + "] while being destroyed. Ignoring."); return; } loge("IsimUiccRecords: handleMessage " + msg + "[" + msg.what + "] "); try { switch (msg.what) { case EVENT_APP_READY: onReady(); break; case IccRecords.EVENT_REFRESH: broadcastRefresh(); super.handleMessage(msg); break; case EVENT_ISIM_AUTHENTICATE_DONE: ar = (AsyncResult)msg.obj; log("EVENT_ISIM_AUTHENTICATE_DONE"); if (ar.exception != null) { log("Exception ISIM AKA: " + ar.exception); } else { try { auth_rsp = (String)ar.result; log("ISIM AKA: auth_rsp = " + auth_rsp); } catch (Exception e) { log("Failed to parse ISIM AKA contents: " + e); } } synchronized (mLock) { mLock.notifyAll(); } break; default: super.handleMessage(msg); } } catch (RuntimeException exc) { Rlog.w(LOG_TAG, "Exception parsing SIM record", exc); } }
Source:
public void reserveSeatWithInvalidTicket() { userTicket.setValid(false); ticketRepository.save(userTicket); SessionData login = login("user", userCleartextPassword); given(). filter(sessionFilter). header(login.getCsrfHeader()). when(). param("ticketId", userTicket.getId()). post("/seats/A/1"). then(). statusCode(HttpStatus.SC_BAD_REQUEST); }

Target:
public void reserveSeatWithInvalidTicket() { userTicket.setValid(false); ticketRepository.save(userTicket); SessionData login = login(user.getUsername(), userCleartextPassword); given(). filter(sessionFilter). header(login.getCsrfHeader()). when(). param("ticketId", userTicket.getId()). post("/seats/A/1"). then(). statusCode(HttpStatus.SC_BAD_REQUEST); }
Source:
public String display( @CliOption(mandatory = true, key = { "", "name" }, help = "the name of the the module") String name, @CliOption(mandatory = true, key = "type", help = "the type of the module") RESTModuleType moduleType) { try { String moduleConfigurationFile = xdShell.getSpringXDOperations().moduleOperations().displayConfigurationFile( moduleType, name); return moduleConfigurationFile; } catch (HttpClientErrorException e) { if (HttpStatus.NOT_FOUND.equals(e.getStatusCode())) { return e.getResponseBodyAsString(); } throw e; } }

Target:
public String display( @CliOption(mandatory = true, key = { "", "name" }, help = "the name of the the module") String name, @CliOption(mandatory = true, key = "type", help = "the type of the module") RESTModuleType moduleType) { final String configurationFileContents = xdShell.getSpringXDOperations().moduleOperations().displayConfigurationFile( moduleType, name); final StringBuilder sb = new StringBuilder() .append(String.format("Configuration file contents for module definiton '%s' (%s)\n\n", name, moduleType)) .append(UiUtils.HORIZONTAL_LINE) .append(configurationFileContents) .append(UiUtils.HORIZONTAL_LINE); return sb.toString(); }
Source:
protected boolean isContainedByBoundType( AnnotatedTypeMirror inside, BoundType outside, boolean canBeCovariant) { if (BoundType.isBoundType(inside)) { BoundType insideBoundType = new BoundType(inside); if (!insideBoundType.hasSuperBound && !outside.hasSuperBound) { return (canBeCovariant || isSubtype(outside.lower, insideBoundType.lower)) && isContainedByBoundType(insideBoundType.upper, outside, canBeCovariant); } else if (outside.hasSuperBound || TypesUtils.isObject(outside.upper.getUnderlyingType())) { return (canBeCovariant || isSubtype(insideBoundType.upper, outside.upper)) && isContainedByBoundType(insideBoundType.lower, outside, canBeCovariant); } } if (BoundType.isBoundType(outside.upper)) { BoundType outsideUpper = new BoundType(outside.upper); Set<AnnotationMirror> setA = AnnotatedTypes.findEffectiveLowerBoundAnnotations( qualifierHierarchy, outsideUpper.lower); Set<AnnotationMirror> setB = AnnotatedTypes.findEffectiveLowerBoundAnnotations( qualifierHierarchy, outside.lower); Set<? extends AnnotationMirror> glb = qualifierHierarchy.greatestLowerBounds(setA, setB); addToLowestBound(outside.lower, glb); return isContainedByBoundType(inside, outsideUpper, canBeCovariant); } else if (BoundType.isBoundType(outside.lower)) { BoundType outsideLower = new BoundType(outside.lower); return isContainedByBoundType(inside, outsideLower, canBeCovariant); } else { if (canBeCovariant) { if (outside.hasSuperBound) { return isSubtype(outside.lower, inside); } else { return isSubtype(inside, outside.upper); } } return isSubtype(outside.lower, inside) && isSubtype(inside, outside.upper); } }

Target:
protected boolean isContainedByBoundType( AnnotatedTypeMirror inside, BoundType outside, boolean canBeCovariant) { AnnotatedTypeMirror insideUpperBound; AnnotatedTypeMirror insideLowerBound; if (BoundType.isBoundType(inside)) { BoundType insideBoundType = new BoundType(inside); insideLowerBound = insideBoundType.lower; insideUpperBound = insideBoundType.upper; } else { insideLowerBound = inside; insideUpperBound = inside; } return isSubtype(insideUpperBound, outside.upper) && isSubtype(outside.lower, insideLowerBound); }
Source:
private Path createActionTemp(Path execRoot) throws IOException { return execRoot.getRelative( java.nio.file.Files.createTempDirectory( java.nio.file.Paths.get(execRoot.getPathString()), "windows-sandbox.") .getFileName() .toString()); }

Target:
private static Path createActionTemp(Path execRoot) throws IOException { return execRoot.getRelative( java.nio.file.Files.createTempDirectory( java.nio.file.Paths.get(execRoot.getPathString()), "windows-sandbox.") .getFileName() .toString()); }
Source:
private void handleSpecialCharacterAndMissingValues() { if (isChecked && this.valueToFreq.size() < 1) { return; } long counted = 0L; List<Object> invalid = new ArrayList<Object>(); List<Object> lengthMore = new ArrayList<Object>(); for (Object val : this.valueToFreq.keySet()) { if (isInvalid(val) < 0) { invalid.add(val); Long freq = this.valueToFreq.get(val); counted = (freq == null) ? counted : counted + freq; } else if (String.valueOf(val).codePointCount(0, String.valueOf(val).length()) > 1) { lengthMore.add(val); } } if (invalid.size() > 0) { for (Object val : invalid) { this.valueToFreq.remove(val); } this.valueToFreq.put(INVALID, counted); } if (lengthMore.size() > 0) { for (Object val : lengthMore) { String k = String.valueOf(val).substring(0, String.valueOf(val).offsetByCodePoints(0, 1)); Long freq = this.valueToFreq.get(val); this.valueToFreq.remove(val); this.valueToFreq.put(k, freq); } } for (int i = 1; i < 10; i++) { Long value = this.valueToFreq.get(String.valueOf(i)); if (value == null) { this.valueToFreq.put(String.valueOf(i), 0L); } } isChecked = true; }

Target:
private void handleSpecialCharacterAndMissingValues() { if (isChecked && this.valueToFreq.size() < 1) { return; } long counted = 0L; List<Object> invalid = new ArrayList<Object>(); List<Object> lengthMore = new ArrayList<Object>(); for (Object val : this.valueToFreq.keySet()) { if (isInvalid(val) < 0) { invalid.add(val); Long freq = this.valueToFreq.get(val); counted = (freq == null) ? counted : counted + freq; } else if (String.valueOf(val).codePoints().count() > 1) { lengthMore.add(val); } } if (invalid.size() > 0) { for (Object val : invalid) { this.valueToFreq.remove(val); } this.valueToFreq.put(INVALID, counted); } if (lengthMore.size() > 0) { for (Object val : lengthMore) { String k = String.valueOf(val).substring(0, String.valueOf(val).offsetByCodePoints(0, 1)); Long freq = this.valueToFreq.get(val); this.valueToFreq.remove(val); this.valueToFreq.put(k, freq); } } for (int i = 1; i < 10; i++) { Long value = this.valueToFreq.get(String.valueOf(i)); if (value == null) { this.valueToFreq.put(String.valueOf(i), 0L); } } isChecked = true; }
Source:
public void onDestroyView() { layerOnMap = null; super.onDestroyView(); }

Target:
public void onDestroyView() { clearGeoJsonLayer(); super.onDestroyView(); }
Source:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { int wmc = (int) JavaMetrics.get(JavaClassMetricKey.WMC, node); double tcc = JavaMetrics.get(JavaClassMetricKey.TCC, node); int atfd = (int) JavaMetrics.get(JavaClassMetricKey.ATFD, node); super.visit(node, data); if (wmc >= WMC_VERY_HIGH && atfd > FEW_ATFD_THRESHOLD && tcc < TCC_THRESHOLD) { addViolation(data, node, new Object[] {wmc, StringUtil.percentageString(tcc, 3, true), atfd, }); } return data; }

Target:
public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { int wmc = (int) JavaMetrics.get(JavaClassMetricKey.WMC, node); double tcc = JavaMetrics.get(JavaClassMetricKey.TCC, node); int atfd = (int) JavaMetrics.get(JavaClassMetricKey.ATFD, node); super.visit(node, data); if (wmc >= WMC_VERY_HIGH && atfd > FEW_ATFD_THRESHOLD && tcc < TCC_THRESHOLD) { addViolation(data, node, new Object[] {wmc, StringUtil.percentageString(tcc, 3), atfd, }); } return data; }
Source:
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { final SqlNode operand = call.getOperandList().get(0); final RelDataType nodeType = validator.deriveType(scope, operand); assert nodeType != null; if (!nodeType.isStruct()) { throw SqlUtil.newContextException(operand.getParserPosition(), Static.RESOURCE.incompatibleTypes()); } final SqlNode fieldId = call.operand(1); final String fieldName = fieldId.toString(); final RelDataTypeField field = nodeType.getField(fieldName, false, false); if (field == null) { throw SqlUtil.newContextException(fieldId.getParserPosition(), Static.RESOURCE.unknownField(fieldName)); } RelDataType type = field.getType(); if (nodeType.isNullable() && !type.isNullable()) { type = validator.getTypeFactory().createTypeWithNullability(type, true); } type = adjustType(validator, call, type); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type; }

Target:
@Override public RelDataType deriveType(SqlValidator validator, SqlValidatorScope scope, SqlCall call) { final SqlNode operand = call.getOperandList().get(0); final RelDataType nodeType = validator.deriveType(scope, operand); assert nodeType != null; if (!nodeType.isStruct()) { throw SqlUtil.newContextException(operand.getParserPosition(), Static.RESOURCE.incompatibleTypes()); } final SqlNode fieldId = call.operand(1); final String fieldName = fieldId.toString(); final RelDataTypeField field = nodeType.getField(fieldName, false, false); if (field == null) { throw SqlUtil.newContextException(fieldId.getParserPosition(), Static.RESOURCE.unknownField(fieldName)); } RelDataType type = field.getType(); if (nodeType.isNullable()) { type = validator.getTypeFactory().createTypeWithNullability(type, true); } type = adjustType(validator, call, type); SqlValidatorUtil.checkCharsetAndCollateConsistentIfCharType(type); return type; }
Source:
public FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS, String delimiterRegex) throws IOException { this.dataFile = Preconditions.checkNotNull(dataFile.getAbsoluteFile()); if (!dataFile.exists() || dataFile.isDirectory()) { throw new FileNotFoundException(dataFile.toString()); } Preconditions.checkArgument(dataFile.length() > 0L, "dataFile is empty"); Preconditions.checkArgument(minReloadIntervalMS >= 0L, "minReloadIntervalMs must be non-negative"); log.info("Creating FileDataModel for file {}", dataFile); this.lastModified = dataFile.lastModified(); this.lastUpdateFileModified = readLastUpdateFileModified(); FileLineIterator iterator = new FileLineIterator(dataFile, false); initilize(iterator, transpose, minReloadIntervalMS, delimiterRegex); }

Target:
public FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS, String delimiterRegex) throws IOException { this.dataFile = Preconditions.checkNotNull(dataFile.getAbsoluteFile()); if (!dataFile.exists() || dataFile.isDirectory()) { throw new FileNotFoundException(dataFile.toString()); } Preconditions.checkArgument(dataFile.length() > 0L, "dataFile is empty"); Preconditions.checkArgument(minReloadIntervalMS >= 0L, "minReloadIntervalMs must be non-negative"); log.info("Creating FileDataModel for file {}", dataFile); this.lastModified = dataFile.lastModified(); this.lastUpdateFileModified = readLastUpdateFileModified(); FileLineIterator iterator = new FileLineIterator(dataFile, false); initialize(iterator, transpose, minReloadIntervalMS, delimiterRegex); }
Source:
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return FFFT.clone(); case '2': return FFTF.clone(); case '3': return FFTT.clone(); case '4': return FTFF.clone(); case '5': return FTFT.clone(); case '6': return FTTF.clone(); case '7': return FTTT.clone(); case '8': return TFFF.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return TFTF.clone(); case 'b':// fall through case 'B': return TFTT.clone(); case 'c':// fall through case 'C': return TTFF.clone(); case 'd':// fall through case 'D': return TTFT.clone(); case 'e':// fall through case 'E': return TTTF.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: throw IllegalArgumentExceptions.format("Cannot interpret '%s' as a hexadecimal digit", hexDigit); } }

Target:
public static boolean[] hexDigitMsb0ToBinary(final char hexDigit) { switch (hexDigit) { case '0': return FFFF.clone(); case '1': return FFFT.clone(); case '2': return FFTF.clone(); case '3': return FFTT.clone(); case '4': return FTFF.clone(); case '5': return FTFT.clone(); case '6': return FTTF.clone(); case '7': return FTTT.clone(); case '8': return TFFF.clone(); case '9': return TFFT.clone(); case 'a':// fall through case 'A': return TFTF.clone(); case 'b':// fall through case 'B': return TFTT.clone(); case 'c':// fall through case 'C': return TTFF.clone(); case 'd':// fall through case 'D': return TTFT.clone(); case 'e':// fall through case 'E': return TTTF.clone(); case 'f':// fall through case 'F': return TTTT.clone(); default: throw IllegalArgumentExceptions.format("Cannot interpret '%d' as a hexadecimal digit", hexDigit); } }
Source:
private DetailNode getJavadocTree(DetailAST blockComment) { return blockCommentToJavadocTree.computeIfAbsent(blockComment, key -> new JavadocDetailNodeParser().parseJavadocAsDetailNode(blockComment).getTree()); }

Target:
private DetailNode getJavadocTree(DetailAST blockComment) { DetailNode javadocTree = blockCommentToJavadocTree.get(blockComment); if (javadocTree == null) { javadocTree = new JavadocDetailNodeParser().parseJavadocAsDetailNode(blockComment) .getTree(); blockCommentToJavadocTree.put(blockComment, javadocTree); } return javadocTree; }
Source:
protected DirCacheEntry keep(DirCacheEntry e) { DirCacheEntry newEntry = new DirCacheEntry(e.getPathString(), e.getStage()); newEntry.setFileMode(e.getFileMode()); newEntry.setObjectId(e.getObjectId()); newEntry.setLastModified(e.getLastModified()); newEntry.setLength(e.getLength()); builder.add(newEntry); return newEntry; }

Target:
private DirCacheEntry keep(DirCacheEntry e) { DirCacheEntry newEntry = new DirCacheEntry(e.getPathString(), e.getStage()); newEntry.setFileMode(e.getFileMode()); newEntry.setObjectId(e.getObjectId()); newEntry.setLastModified(e.getLastModified()); newEntry.setLength(e.getLength()); builder.add(newEntry); return newEntry; }
Source:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { final MockStore realStore = new MockStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(realStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final MockCacheWriter realCache = new MockCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(realCache); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); assertFalse(ehcache.remove("key", "value")); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(realCache.getEntries().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }

Target:
public void testRemoveValueUnequalStoreEntryCacheAccessExceptionUnequalCacheWriterEntry() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.singletonMap("key", "unequalValue")); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); final FakeCacheWriter fakeWriter = new FakeCacheWriter(Collections.singletonMap("key", "unequalValue")); this.cacheWriter = spy(fakeWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.cacheWriter); ehcache.remove("key", "value"); verify(this.store).computeIfPresent(eq("key"), getAnyBiFunction()); verify(this.spiedResilienceStrategy) .removeFailure(eq("key"), eq("value"), any(CacheAccessException.class), eq(false)); assertThat(fakeWriter.getEntryMap().get("key"), is(equalTo("unequalValue"))); validateStats(ehcache, EnumSet.of(CacheOperationOutcomes.RemoveOutcome.FAILURE)); }
Source:
public void saveAs(File newFolder) throws IOException { File newPrimary = checkNewFoldername(newFolder); if (!newFolder.mkdirs()) { String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath()); throw new IOException(msg); } for (SketchFile file : files) { if (file.isPrimary()) file.saveAs(newPrimary); else file.saveAs(new File(newFolder, file.getFileName())); } if (getDataFolder().exists()) { File newDataFolder = new File(newFolder, "data"); if (!newDataFolder.mkdirs()) { String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath()); throw new IOException(msg); } FileUtils.copy(getDataFolder(), newDataFolder); } folder = newFolder; }

Target:
public void saveAs(File newFolder) throws IOException { File newPrimary = checkNewFoldername(newFolder); if (!newFolder.mkdirs()) { String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath()); throw new IOException(msg); } for (SketchFile file : files) { if (file.isPrimary()) file.saveAs(newPrimary); else file.saveAs(new File(newFolder, file.getFileName())); } if (getDataFolder().exists()) { File newDataFolder = new File(newFolder, "data"); if (!newDataFolder.exists() && !newDataFolder.mkdirs()) { String msg = I18n.format(tr("Could not create directory \"{0}\""), newFolder.getAbsolutePath()); throw new IOException(msg); } FileUtils.copy(getDataFolder(), newDataFolder); } folder = newFolder; }
Source:
private AbstractRecord createRecord(XAResource xaRes, Object[] params, Xid xid) { final AbstractRecord record; if (_exceptionDeferrers == null) _exceptionDeferrers = new ArrayList<>(); if ((xaRes instanceof LastResourceCommitOptimisation) || ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE .isInstance(xaRes))) { XAOnePhaseResource resource = new XAOnePhaseResource(xaRes, xid, params); record = new LastResourceRecord(resource); _exceptionDeferrers.add(resource); } else { XAResourceRecord xaResourceRecord = new XAResourceRecord(this, xaRes, xid, params); record = xaResourceRecord; _exceptionDeferrers.add(xaResourceRecord); } return record; }

Target:
private AbstractRecord createRecord(XAResource xaRes, Object[] params, Xid xid) { if ((xaRes instanceof LastResourceCommitOptimisation) || ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE .isInstance(xaRes))) { if (xaRes instanceof ConnectableResource) { String jndiName = ((XAResourceWrapper)xaRes).getJndiName(); if (commitMarkableResourceJNDINames.contains(jndiName)) { try { return new CommitMarkableResourceRecord(this, ((ConnectableResource)xaRes), xid, _theTransaction); } catch (IllegalStateException | RollbackException | SystemException e) { tsLogger.logger.warn("Could not register synchronization for CommitMarkableResourceRecord", e); return null; } } } return new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params)); } else { return new XAResourceRecord(this, xaRes, xid, params); } }
Source:
public static Optional<Offset> parse(String offset) { String[] parts = offset.split("::"); if (offset.equals("0")) { return Optional.empty(); } if (parts.length != 2) { try { throw new DataParserException(Errors.EXCEL_PARSER_01); } catch (DataParserException e) { e.printStackTrace(); } } String sheetName = parts[0]; int rowNum = Integer.parseInt(parts[1]); return Optional.of(new Offset(sheetName, rowNum)); }

Target:
public static Optional<Offset> parse(String offset) throws DataParserException { if (offset.equals("0")) { return Optional.empty(); } String[] parts = offset.split("::"); if (parts.length != 2) { throw new DataParserException(Errors.EXCEL_PARSER_06, offset); } String sheetName = parts[0]; int rowNum = Integer.parseInt(parts[1]); return Optional.of(new Offset(sheetName, rowNum)); }
Source:
public Result execute(UIExecutionContext context) throws Exception { XMLResource formatProfileLocation = profile.getValue(); Iterable<FileResource> formatSources = sources.getValue(); List<FileResource<?>> fileResourceList = new ArrayList<>(); for (FileResource<?> fileResource : formatSources) fileResourceList.add(fileResource); if (formatProfileLocation == null) format(fileResourceList); else { Properties formatProfile = new Properties(); formatProfile.load(formatProfileLocation.getResourceInputStream()); format(fileResourceList, formatProfile); } return Results.success("Files Formatted Sucessfully"); }

Target:
public Result execute(UIExecutionContext context) throws Exception { XMLResource formatProfileLocation = profile.getValue(); Iterable<FileResource> formatSources = sources.getValue(); List<FileResource<?>> fileResourceList = new ArrayList<>(); if (!formatSources.iterator().hasNext()) { UISelection<Resource> us = context.getUIContext().getInitialSelection(); Resource<?> rs = us.get(); FileResource<?> fr = (FileResource) rs.reify(FileResource.class); fileResourceList.add(fr); } else for (FileResource<?> fileResource : formatSources) fileResourceList.add(fileResource); Properties formatProfile; if (formatProfileLocation == null || !formatProfileLocation.exists()) formatProfile = null; else { formatProfile = new Properties(); formatProfile.load(formatProfileLocation.getResourceInputStream()); } format(fileResourceList, formatProfile); return Results.success("Files Formatted Sucessfully"); }
Source:
protected void EndSuccessfully() { VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } setSucceeded(true); } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } }

Target:
protected void EndSuccessfully() { EndActionOnAllImageGroups(); VM vm = getVm(); if (vm != null) { VmHandler.UnLockVm(vm.getId()); endDiskRelatedActions(vm); if (getParameters().getCopyCollapse()) { this.endCopyCollapseOperations(vm); } else { this.endDefaultOps(vm); } } else { setCommandShouldBeLogged(false); log.warn("ExportVmCommand::EndMoveVmCommand: Vm is null - not performing full EndAction"); } setSucceeded(true); }
Source:
public E remove(int index) { throw new UnsupportedOperationException("No delete(int) in " + this.getClass().getName()); }

Target:
public E remove(int index) { throw new UnsupportedOperationException("No remove(int) in " + this.getClass().getName()); }
Source:
public B channel(Class<? extends C> channelClass) { ObjectUtil.checkNotNull(channelClass, "channelClass"); return channelFactory(new ReflectiveChannelFactory<C>(channelClass)); }

Target:
public B channel(Class<? extends C> channelClass) { return channelFactory(new ReflectiveChannelFactory<C>( ObjectUtil.checkNotNull(channelClass, "channelClass") )); }
Source:
private int getPortOffset() { ServerConfiguration carbonConfig = ServerConfiguration.getInstance(); String portOffset = System.getProperty("portOffset", carbonConfig.getFirstProperty(CARBON_CONFIG_PORT_OFFSET)); try { if ((portOffset != null)) { return Integer.parseInt(portOffset.trim()); } else { return CARBON_DEFAULT_PORT_OFFSET; } } catch (NumberFormatException e) { return CARBON_DEFAULT_PORT_OFFSET; } }

Target:
private int getPortOffset() { ServerConfiguration carbonConfig = ServerConfiguration.getInstance(); String portOffset = System.getProperty("portOffset", carbonConfig.getFirstProperty(CARBON_CONFIG_PORT_OFFSET)); try { if ((portOffset != null)) { return Integer.parseInt(portOffset.trim()); } return CARBON_DEFAULT_PORT_OFFSET; } catch (NumberFormatException e) { return CARBON_DEFAULT_PORT_OFFSET; } }
Source:
public static String parseJson(String inputString, String inputSchema) throws ValidatorException, ParserException { if (inputString != null && !inputString.isEmpty() && inputSchema != null && !inputSchema.isEmpty()) { JsonObject schemaObject; JsonElement schema = parser.parse(inputSchema); if (schema.isJsonObject()) { schemaObject = schema.getAsJsonObject(); } else if (schema.isJsonPrimitive()) { boolean valid = schema.getAsBoolean(); if (valid) { return inputString; } else { ValidatorException exception = new ValidatorException("JSON schema is not valid for all elements"); logger.error("JSON schema is false, so all validations will fail", exception); throw exception; } } else { ValidatorException exception = new ValidatorException("Unexpected JSON schema"); logger.error("JSON schema should be an object or boolean", exception); throw exception; } return parseJson(inputString, schemaObject); } else { ParserException exception = new ParserException("Invalid inputs"); logger.error("Input json and schema should not be null", exception); throw exception; } }

Target:
public static String parseJson(String inputString, String inputSchema) throws ValidatorException, ParserException { if (StringUtils.isNotEmpty(inputString) && StringUtils.isNotEmpty(inputSchema)) { JsonObject schemaObject; JsonElement schema; try { schema = parser.parse(inputSchema); } catch (JsonSyntaxException ex) { throw new ValidatorException("Invalid JSON schema", ex); } if (schema.isJsonObject()) { if (schema.toString().replaceAll("\\s+","").equals("{}")) { return inputString; } schemaObject = schema.getAsJsonObject(); } else if (schema.isJsonPrimitive()) { boolean valid = schema.getAsBoolean(); if (valid) { return inputString; } else { throw new ValidatorException("JSON schema is false, so all validations will fail"); } } else { throw new ValidatorException("JSON schema should be an object or boolean"); } return parseJson(inputString, schemaObject); } else { throw new ParserException("Input json and schema should not be null"); } }
Source:
public <T> TypeAdapter<T> getDelegateAdapter(TypeAdapterFactory skipPast, TypeToken<T> type) { boolean skipPastFound = false; if (!factories.contains(skipPast)) { skipPast = jsonAdapterFactory; } for (TypeAdapterFactory factory : factories) { if (!skipPastFound) { if (factory == skipPast) { skipPastFound = true; } continue; } TypeAdapter<T> candidate = factory.create(this, type); if (candidate != null) { return candidate; } } throw new IllegalArgumentException("GSON cannot serialize " + type); }

Target:
public <T> TypeAdapter<T> getDelegateAdapter(TypeAdapterFactory skipPast, TypeToken<T> type) { if (!factories.contains(skipPast)) { skipPast = jsonAdapterFactory; } boolean skipPastFound = false; for (TypeAdapterFactory factory : factories) { if (!skipPastFound) { if (factory == skipPast) { skipPastFound = true; } continue; } TypeAdapter<T> candidate = factory.create(this, type); if (candidate != null) { return candidate; } } throw new IllegalArgumentException("GSON cannot serialize " + type); }
Source:
private static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }

Target:
public static String getVersion() { final String defaultVersion = "dev-" + System.currentTimeMillis(); final String fileName = "bigtable-hbase-version.properties"; final String versionProperty = "bigtable-hbase.version"; try (InputStream stream = BigtableHBaseVersion.class.getResourceAsStream(fileName)) { if (stream == null) { LOG.error("Could not load properties file %s", fileName); return defaultVersion; } Properties properties = new Properties(); properties.load(stream); String value = properties.getProperty(versionProperty); if (value == null) { LOG.error("%s not found in %s.", versionProperty, fileName); } else if (value.startsWith("$")) { LOG.info("%s property is not replaced.", versionProperty); } else { return value; } } catch (IOException e) { LOG.error("Error while trying to get user agent name from %s", e, fileName); } return defaultVersion; }
Source:
public Map<String, ? extends TargetState> getTargetState() throws ThingIFException{ if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/states", this.app.getAppID(), this.target.getTypedID().toString()); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); Map retMap = new HashMap<>(); Iterator it = responseBody.keys(); while (it.hasNext()) { String key = (String)it.next(); try { JsonObject object = new JsonParser() .parse(responseBody.getJSONObject(key).toString()).getAsJsonObject(); retMap.put(key, this.gson.fromJson(object, this.stateTypes.get(key))); } catch (JSONException e) { throw new IllegalStateException("Unknown target state class: " + key); } } return retMap; }

Target:
public Map<String, ? extends TargetState> getTargetState() throws ThingIFException{ if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/states", this.app.getAppID(), this.target.getTypedID().toString()); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); Map retMap = new HashMap<>(); Iterator it = responseBody.keys(); while (it.hasNext()) { String key = (String)it.next(); if (!this.stateTypes.containsKey(key)) { throw new UnregisteredAliasException(key, false); } try { JsonObject object = new JsonParser() .parse(responseBody.getJSONObject(key).toString()).getAsJsonObject(); retMap.put(key, this.gson.fromJson(object, this.stateTypes.get(key))); } catch (JSONException e) { throw new ThingIFException("Unexpected exception."); } } return retMap; }
Source:
public void noCall() { elasticsearchClient.index( INDEX_NAME ) .deleteAndCreate() .type().putMapping( "{" + "'dynamic': 'strict'," + "'properties': {" + "'myField': {" + "'type': 'text'" + "}" + "}" + "}" ); elasticsearchClientSpy.expectNext( ElasticsearchRequest.get().build(), ElasticsearchRequestAssertionMode.EXTENSIBLE ); setupHelper.withDefaultConfiguration( BACKEND_NAME ) .withBackendProperty( BACKEND_NAME, ElasticsearchBackendSpiSettings.CLIENT_FACTORY, elasticsearchClientSpy.getFactory() ) .withIndexDefaultsProperty( BACKEND_NAME, ElasticsearchIndexSettings.LIFECYCLE_STRATEGY, ElasticsearchIndexLifecycleStrategyName.NONE.getExternalRepresentation() ) .withIndex( INDEX_NAME, ctx -> { IndexSchemaElement root = ctx.getSchemaElement(); root.field( "field", f -> f.asString() ).toReference(); }, indexManager -> { } ) .setup(); elasticsearchClientSpy.verifyExpectationsMet(); }

Target:
public void noCall() { elasticsearchClientSpy.expectNext( ElasticsearchRequest.get().build(), ElasticsearchRequestAssertionMode.EXTENSIBLE ); setupHelper.withDefaultConfiguration( BACKEND_NAME ) .withBackendProperty( BACKEND_NAME, ElasticsearchBackendSpiSettings.CLIENT_FACTORY, elasticsearchClientSpy.getFactory() ) .withIndexDefaultsProperty( BACKEND_NAME, ElasticsearchIndexSettings.LIFECYCLE_STRATEGY, ElasticsearchIndexLifecycleStrategyName.NONE.getExternalRepresentation() ) .withIndex( INDEX_NAME, ctx -> { IndexSchemaElement root = ctx.getSchemaElement(); root.field( "field", f -> f.asString() ).toReference(); }, indexManager -> { } ) .setup(); elasticsearchClientSpy.verifyExpectationsMet(); }
Source:
public ProjectResponse getProject(String spaceName, String projectName) { log.info("Getting space '{}'", spaceName); return target.path("spaces/{spaceName}/projects/{projectName}") .resolveTemplate("spaceName", spaceName) .resolveTemplate("projectName", projectName) .request().get(ProjectResponse.class); }

Target:
public ProjectResponse getProject(String spaceName, String projectName) { log.info("Getting project '{}'", spaceName); return target.path("spaces/{spaceName}/projects/{projectName}") .resolveTemplate("spaceName", spaceName) .resolveTemplate("projectName", projectName) .request().get(ProjectResponse.class); }
Source:
public List<Long> getAmountOfImagesForTasksWithProcessingStatusForNotTemplateProcessesForProjectIdOrderByOrdering( Integer processingStatus, Integer projectId) { return getSum( "SELECT SUM(p.sortHelperImages) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = " + projectId + " WHERE t.processingStatus = " + processingStatus + " GROUP BY t.title ORDER BY t.ordering"); }

Target:
public List<Long> getAmountOfImagesForTasksWithProcessingStatusForNotTemplateProcessesForProjectIdOrderByOrdering( Integer processingStatus, Integer projectId) { Map<String, Object> parameters = new HashMap<>(); parameters.put("projectId", projectId); parameters.put("processingStatus", processingStatus); return getSum( "SELECT SUM(p.sortHelperImages) FROM Task AS t INNER JOIN t.process AS p INNER JOIN p.project AS pr " + "WITH pr.id = :projectId WHERE t.processingStatus = :processingStatus " + "GROUP BY t.title ORDER BY t.ordering", parameters); }
Source:
public String getName() { if (name.matches(".*0[1-9][0-9].*")) return name.replaceFirst("0", ""); else if (name.matches(".*0{2}[1-9].*")) return name.replaceAll("0", ""); else return name; }

Target:
public String getName() { name = name.replace("00", ""); if (name.contains("0")) { for (int i = name.length() - 1; i > 0; i--) { if (Character.isDigit(name.charAt(i)) && name.charAt(i - 1) == '0') { name = name.substring(0, i - 1) + name.substring(i); break; } } } return name; }
Source:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { HaleConnectService hcs = getServiceProvider().getService(HaleConnectService.class); LocatableInputSupplier<? extends InputStream> hcSource; try { hcSource = hcs.loadProject(owner, projectId); } catch (HaleConnectException e) { throw new IllegalStateException(); } super.setSource(hcSource); return super.execute(progress, reporter); }

Target:
protected IOReport execute(ProgressIndicator progress, IOReporter reporter) throws IOProviderConfigurationException, IOException { HaleConnectService hcs = getServiceProvider().getService(HaleConnectService.class); LocatableInputSupplier<? extends InputStream> hcSource; try { hcSource = hcs.loadProject(owner, projectId); } catch (HaleConnectException e) { throw new IllegalStateException(e.getMessage(), e); } super.setSource(hcSource); return super.execute(progress, reporter); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) return false; UploadOptions that = (UploadOptions) obj; return ObjectsCompat.equals(bucket, that.bucket) && ObjectsCompat.equals(metadata, that.metadata) && cannedAcl == that.cannedAcl && ObjectsCompat.equals(listener, that.listener); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } UploadOptions that = (UploadOptions) obj; return ObjectsCompat.equals(bucket, that.bucket) && ObjectsCompat.equals(metadata, that.metadata) && cannedAcl == that.cannedAcl && ObjectsCompat.equals(listener, that.listener); }
Source:
public boolean select(Viewer viewer, Object parent, Object element) { if (element instanceof File) { File file= (File) element; if (file.isFile()) { return isArchive(file); } else if (fAcceptFolders) { return true; } else { File[] listFiles= file.listFiles(); if (listFiles != null) { for (File listFile : listFiles) { if (select(viewer, file, listFile)) { return true; } } } } } return false; }

Target:
public boolean select(Viewer viewer, Object parent, Object element) { if (element instanceof File) { File file= (File) element; if (file.isFile()) { return isArchive(file); } else if (fAcceptFolders) { return true; } else { File[] listFiles= file.listFiles(); if (listFiles != null) { for (File f : listFiles) { if (select(viewer, file, f)) { return true; } } } } } return false; }
Source:
public void add(@Nonnull Iterable<T> runItems, @Nonnull List<Queue.Item> queueItems) { sort(queueItems); addInternal(IterableUtils.chainedIterable(queueItems, runItems)); }

Target:
public void add(@Nonnull Iterable<T> runItems, @Nonnull List<Queue.Item> queueItems) { sort(queueItems); addInternal(Iterables.concat(queueItems, runItems)); }
Source:
private static String getRawUrlUri(String rawUrl) { String uri = rawUrl; URL url; try { url = new URL(rawUrl); if ("github.com".equals(url.getHost())) { uri = "https://api." + url.getHost(); } else { String port = ""; boolean httpOk = "http".equals(url.getProtocol()) && url.getPort() == 80; boolean httpsOk = "https".equals(url.getProtocol()) && url.getPort() == 443; if (!httpOk && !httpsOk && url.getPort()!= -1){ port = ":"+url.getPort(); } uri = url.getProtocol()+"://" + url.getHost() + port + "/api/v3"; } } catch (MalformedURLException e) { LOGGER.log(Level.WARNING, "Malformed repository URL {0}", rawUrl); } return uri; }

Target:
private static String getRawUrlUri(String rawUrl) { String uri = rawUrl; URL url; try { url = new URL(rawUrl); if ("github.com".equals(url.getHost())) { uri = "https://api." + url.getHost(); } else { String port = ""; boolean httpOk = "http".equals(url.getProtocol()) && url.getPort() == 80; boolean httpsOk = "https".equals(url.getProtocol()) && url.getPort() == 443; if (!httpOk && !httpsOk && url.getPort()!= -1){ port = ":"+url.getPort(); } uri = url.getProtocol()+"://" + url.getHost() + port + "/api/v3"; } } catch (MalformedURLException e) { LOGGER.log(Level.WARNING, "Malformed repository URL {0}", rawUrl); throw new IllegalArgumentException("Repository URL not valid:" + rawUrl, e); } return GitHubConfiguration.normalizeApiUri(uri); }