auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void persist(final Runnable commitRunnable) { final List<Pair<FireHydrant, Interval>> indexesToPersist = Lists.newArrayList(); for (Sink sink : sinks.values()) { if (sink.swappable()) { indexesToPersist.add(Pair.of(sink.swap(), sink.getInterval())); } } log.info("Submitting persist runnable for dataSource[%s]", schema.getDataSource()); final Stopwatch runExecStopwatch = Stopwatch.createStarted(); final Stopwatch persistStopwatch = Stopwatch.createStarted(); persistExecutor.execute( new ThreadRenamingRunnable(String.format("%s-incremental-persist", schema.getDataSource())) { @Override public void doRun() { try { for (Pair<FireHydrant, Interval> pair : indexesToPersist) { metrics.incrementRowOutputCount(persistHydrant(pair.lhs, schema, pair.rhs)); } commitRunnable.run(); } catch (Exception e) { metrics.incrementFailedPersists(); } finally { metrics.incrementNumPersists(); metrics.incrementPersistTimeMillis(persistStopwatch.elapsed(TimeUnit.MILLISECONDS)); persistStopwatch.stop(); } } } ); final long startDelay = runExecStopwatch.elapsed(TimeUnit.MILLISECONDS); metrics.incrementPersistBackPressureMillis(startDelay); if (startDelay > WARN_DELAY) { log.warn("Ingestion was throttled for [%,d] millis because persists were pending.", startDelay); } runExecStopwatch.stop(); }

Target:
public void persist(final Runnable commitRunnable) { final List<Pair<FireHydrant, Interval>> indexesToPersist = Lists.newArrayList(); for (Sink sink : sinks.values()) { if (sink.swappable()) { indexesToPersist.add(Pair.of(sink.swap(), sink.getInterval())); } } log.info("Submitting persist runnable for dataSource[%s]", schema.getDataSource()); final Stopwatch runExecStopwatch = Stopwatch.createStarted(); final Stopwatch persistStopwatch = Stopwatch.createStarted(); persistExecutor.execute( new ThreadRenamingRunnable(String.format("%s-incremental-persist", schema.getDataSource())) { @Override public void doRun() { try { for (Pair<FireHydrant, Interval> pair : indexesToPersist) { metrics.incrementRowOutputCount(persistHydrant(pair.lhs, schema, pair.rhs)); } commitRunnable.run(); } catch (Exception e) { metrics.incrementFailedPersists(); throw e; } finally { metrics.incrementNumPersists(); metrics.incrementPersistTimeMillis(persistStopwatch.elapsed(TimeUnit.MILLISECONDS)); persistStopwatch.stop(); } } } ); final long startDelay = runExecStopwatch.elapsed(TimeUnit.MILLISECONDS); metrics.incrementPersistBackPressureMillis(startDelay); if (startDelay > WARN_DELAY) { log.warn("Ingestion was throttled for [%,d] millis because persists were pending.", startDelay); } runExecStopwatch.stop(); }
Source:
protected void addJREClasspathContainer(IClasspathDescriptor classpath, String environmentId) { IClasspathEntry cpe; IExecutionEnvironment executionEnvironment = getExecutionEnvironment(environmentId); if(executionEnvironment == null) { cpe = JavaRuntime.getDefaultJREContainerEntry(); } else { IPath containerPath = JavaRuntime.newJREContainerPath(executionEnvironment); cpe = JavaCore.newContainerEntry(containerPath); } classpath.addAndReplaceEntry(cpe, new ClasspathDescriptor.EntryFilter() { public boolean accept(IClasspathEntryDescriptor descriptor) { return JavaRuntime.JRE_CONTAINER.equals(descriptor.getPath().segment(0)); } }); }

Target:
protected void addJREClasspathContainer(IClasspathDescriptor classpath, String environmentId) { IClasspathEntry cpe; IExecutionEnvironment executionEnvironment = getExecutionEnvironment(environmentId); if(executionEnvironment == null) { cpe = JavaRuntime.getDefaultJREContainerEntry(); } else { IPath containerPath = JavaRuntime.newJREContainerPath(executionEnvironment); cpe = JavaCore.newContainerEntry(containerPath); } IClasspathEntryDescriptor cped = classpath.replaceEntry(new ClasspathDescriptor.EntryFilter() { public boolean accept(IClasspathEntryDescriptor descriptor) { return JavaRuntime.JRE_CONTAINER.equals(descriptor.getPath().segment(0)); } }, cpe); if(cped == null) { classpath.addEntry(cpe); } }
Source:
public String getMoveAfterErrors() { if (resolveHostsDynamically) { try { return VFSUtils.resolveUriHost(moveAfterErrors); } catch (UnknownHostException | FileSystemException e) { log.warn("Unable to resolving hostname of transport.vfs.MoveAfterErrors: " + VFSUtils.maskURLPassword(moveAfterErrors), e); } } return moveAfterErrors; }

Target:
public String getMoveAfterErrors() { if (resolveHostsDynamically) { try { return VFSUtils.resolveUriHost(moveAfterErrors); } catch (UnknownHostException | FileSystemException e) { log.warn("Unable to resolve the hostname of transport.vfs.MoveAfterErrors: " + VFSUtils.maskURLPassword(moveAfterErrors), e); } } return moveAfterErrors; }
Source:
public CliCommand init(final Arguments args) throws Exception { this.id = UUID.fromString(args.getId()); if (this.id == null) { throw new MissingOptionException("The eject storage domain command requires '-i' to be set."); } this.bucket = args.getBucket(); this.ejectLabel = args.GetEjectLabel(); this.ejectLocation = args.GetEjectLocation(); return this; }

Target:
public CliCommand init(final Arguments args) throws Exception { if (args.getId() == null) { throw new MissingOptionException("The eject storage domain command requires '-i' to be set."); } this.id = UUID.fromString(args.getId()); this.bucket = args.getBucket(); if (Guard.isStringNullOrEmpty(this.bucket)) { throw new MissingOptionException("The eject storage domain command requires '-b' to be set."); } this.ejectLabel = args.GetEjectLabel(); this.ejectLocation = args.GetEjectLocation(); return this; }
Source:
public void updateDocument(String operation, IndexDocumentBean idb) throws IndexingException { try { SolrInputDocument sid = new SolrInputDocument(); Map<String, Object> fields = idb.getDynamicFields(); for (Entry<String, Object> field : fields.entrySet()) { String fieldName = field.getKey(); if (UPDATE_TIMESTAMP.equals(fieldName)) { continue; } Object value = field.getValue(); if (ID.getSolrField().equals(fieldName)) { sid.addField(fieldName, value); continue; } } if (log.isDebugEnabled()) { log.debug("Performing partial update:\n{}", ClientUtils.toXML(sid)); } updateSolrClient.add(sid); } catch (IOException e) { throw new IndexingException("Failed to add document to solr", e); } catch (SolrServerException e) { throw new IndexingException("Failed to add document to solr", e); } }

Target:
public void updateDocument(String operation, IndexDocumentBean idb) throws IndexingException { try { SolrInputDocument sid = new SolrInputDocument(); Map<String, Object> fields = idb.getDynamicFields(); for (Entry<String, Object> field : fields.entrySet()) { String fieldName = field.getKey(); if (UPDATE_TIMESTAMP.equals(fieldName)) { continue; } Object value = field.getValue(); if (ID.getSolrField().equals(fieldName)) { sid.addField(fieldName, value); continue; } Map<String, Object> partialUpdate = new HashMap<>(); partialUpdate.put(operation, value); sid.setField(fieldName, partialUpdate); } if (log.isDebugEnabled()) { log.debug("Performing partial update:\n{}", ClientUtils.toXML(sid)); } updateSolrClient.add(sid); } catch (IOException e) { throw new IndexingException("Failed to add document to solr", e); } catch (SolrServerException e) { throw new IndexingException("Failed to add document to solr", e); } }
Source:
public ProgramState stackValue(SymbolicValue sv) { Deque<SymbolicValue> newStack = new LinkedList<>(stack); newStack.push(sv); return new ProgramState(this, newStack); }

Target:
ProgramState stackValue(SymbolicValue sv) { Deque<SymbolicValue> newStack = new LinkedList<>(stack); newStack.push(sv); return new ProgramState(this, newStack); }
Source:
protected List<String> getPrefixKeys(String key) { List<String> ret = new ArrayList<>(10); Iterable<String> split = Splitter.on('.').split(key); String path = null; for (String part : split) { if (path == null) { path = part; } else { path += "." + part; } ret.add(path); } if (path == null) { ret.add(key); } return ret; }

Target:
protected List<String> getPrefixKeys(String key) { List<String> ret = new ArrayList<>(10); int i=0; while ((i = key.indexOf('.', i)) > 0) { ret.add(key.substring(0, i++)); } ret.add(key); return ret; }
Source:
public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); if (BIG_BANG.equals(ts)) { return 1; } if (BIG_CRUNCH.equals(ts)) { return -1; } if (this == ts || (value == ts.getValue() && scale == ts.getScale())) { return 0; } if (getScale() == ts.getScale()) { final long delta = saturatedAdd(getValue(), -ts.getValue()); return (delta == 0) ? 0 : (delta > 0) ? 1 : -1; } final ITmfTimestamp nts = ts.normalize(0, scale); if (hasSaturated(ts, nts)) { final long otherValue = ts.getValue(); if (value == 0 && otherValue == 0) { return 0; } if (value < 0 && otherValue >= 0) { return -1; } if (value >= 0 && otherValue < 0) { return 1; } final int otherScale = ts.getScale(); return (scale > otherScale) ? (otherValue >= 0) ? 1 : -1 : (otherValue >= 0) ? -1 : 1; } final long delta = value - nts.getValue(); return Long.compare(delta, 0); }

Target:
public int compareTo(final ITmfTimestamp ts) { long value = getValue(); int scale = getScale(); if (BIG_BANG.equals(ts)) { return 1; } if (BIG_CRUNCH.equals(ts)) { return -1; } if (this == ts || isIdentical(this, ts)) { return 0; } if (scale == ts.getScale()) { if(ts.getValue() == Long.MIN_VALUE){ return 1; } final long delta = saturatedAdd(getValue(), -ts.getValue()); return Long.compare(delta, 0); } final ITmfTimestamp largerScale = (scale > ts.getScale()) ? this : ts; final ITmfTimestamp smallerScale = (scale < ts.getScale()) ? this : ts; final ITmfTimestamp nts = largerScale.normalize(0, smallerScale.getScale()); if (hasSaturated(largerScale, nts)) { if (smallerScale.getScale() == scale) { return Long.compare(0, nts.getValue()); } return Long.compare(nts.getValue(), 0); } if (smallerScale.getScale() == scale) { if(nts.getValue()==Long.MIN_VALUE){ return 1; } final long delta = saturatedAdd(value, - nts.getValue()); return Long.compare(delta, 0); } if (smallerScale.getValue() == Long.MIN_VALUE) { return 1; } final long delta = saturatedAdd(-smallerScale.getValue(), nts.getValue()); return Long.compare(delta, 0); }
Source:
public void getAuthorizationFailureTest() throws Exception { MockId addedId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, addedId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, addedId.getContainerId()); if (store.getStoreConfig().storeValidateAuthorization == true) { verifyGetFailure(new MockId(addedId.getID()), StoreErrorCodes.Authorization_Failure); } else { store.get(Collections.singletonList(addedId), EnumSet.noneOf(StoreGetOptions.class)); } }

Target:
public void getAuthorizationFailureTest() throws Exception { MockId mockId = put(1, PUT_RECORD_SIZE, Utils.Infinite_Time).get(0); assertNotSame("accountId should not be -1 for added Blob.", -1, mockId.getAccountId()); assertNotSame("containerId should not be -1 for added Blob.", -1, mockId.getContainerId()); short[] accountIds = {-1, Utils.getRandomShort(TestUtils.RANDOM), -1, mockId.getAccountId(), Utils.getRandomShort(TestUtils.RANDOM)}; short[] containerIds = {-1, -1, Utils.getRandomShort(TestUtils.RANDOM), Utils.getRandomShort( TestUtils.RANDOM), mockId.getContainerId()}; for (int i = 0; i < accountIds.length; i++) { verifyGetFailure(new MockId(mockId.getID(), accountIds[i], containerIds[i]), StoreErrorCodes.Authorization_Failure); } }
Source:
public Response createNewPayment(JsonNode node) { int amount = node.get("amount").asInt(); String connectorRequestPayload = jsonStringBuilder() .add("amount", amount).build(); JsonNode connectorResponse = ClientBuilder .newClient() .target(config.getConnectorUrl()) .request(APPLICATION_JSON_TYPE) .post( Entity.json(connectorRequestPayload), JsonNode.class ); String payId = connectorResponse.get("pay_id").asText(); String responsePayload = jsonStringBuilder() .add("pay_id", payId) .build(); return Response.ok(responsePayload).build(); }

Target:
public Response createNewPayment(JsonNode node) { int amount = node.get("amount").asInt(); String connectorRequestPayload = jsonStringBuilder() .add("amount", amount).build(); JsonNode connectorResponse = client .target(connectorUrl) .request(APPLICATION_JSON_TYPE) .post( Entity.json(connectorRequestPayload), JsonNode.class ); String payId = connectorResponse.get("pay_id").asText(); String responsePayload = jsonStringBuilder() .add("pay_id", payId) .build(); return Response.ok(responsePayload).build(); }
Source:
public void sortFile() { try { FileReader fileReader = new FileReader(this.resultFile); BufferedReader reader = new BufferedReader(fileReader); String line; ArrayList<String> fullText = new ArrayList<>(); while ((line = reader.readLine()) != null) { fullText.add(line); } System.out.println("Sorting....."); Collections.sort(fullText); String[] sortedText = fullText.toArray(new String[fullText.size()]); this.eraseFile(); this.writeToFile(sortedText); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void sortFile() { File resultFile = new File(path); try { FileReader fileReader = new FileReader(resultFile); BufferedReader reader = new BufferedReader(fileReader); String line; ArrayList<String> fullText = new ArrayList<>(); while ((line = reader.readLine()) != null) { fullText.add(line); } logger.log(Level.INFO, "Sorting....."); Collections.sort(fullText); String[] sortedText = fullText.toArray(new String[fullText.size()]); this.eraseFile(resultFile); this.writeToFile(sortedText); } catch (IOException e) { e.printStackTrace(); } }
Source:
public static Object[][] outputFies() { return new Object[][] { {OUTPUT_DATA_PATH + "updateVcfSequenceDictionaryTest-delete-me" + VcfUtils.COMPRESSED_VCF_ENDING}, {OUTPUT_DATA_PATH + "updateVcfSequenceDictionaryTest-delete-me" + VcfUtils.UNCOMPRESSED_VCF_ENDING}, {STD_OUT_NAME} }; }

Target:
public static Object[][] outputFies() { return new Object[][] { {OUTPUT_DATA_PATH + "updateVcfSequenceDictionaryTest-delete-me" + IOUtil.COMPRESSED_VCF_FILE_EXTENSION}, {OUTPUT_DATA_PATH + "updateVcfSequenceDictionaryTest-delete-me" + IOUtil.VCF_FILE_EXTENSION}, {STD_OUT_NAME} }; }
Source:
public static INDArray expandDims(INDArray input, int dimension) { if (dimension < 0) dimension += input.rank(); long[] shape = input.shape(); long[] indexes = new long[input.rank() + 1]; for (int i = 0; i < indexes.length; i++) indexes[i] = i < dimension ? shape[i] : i == dimension ? 1 : shape[i - 1]; return input.reshape(indexes); }

Target:
public static INDArray expandDims(INDArray input, int dimension) { if (dimension < 0) dimension += input.rank(); long[] shape = input.shape(); long[] indexes = new long[input.rank() + 1]; for (int i = 0; i < indexes.length; i++) indexes[i] = i < dimension ? shape[i] : i == dimension ? 1 : shape[i - 1]; return input.reshape(input.ordering(), indexes); }
Source:
public void addDataFile(MockDataFile dataFileSource) { List<String> columnNames = dataFileSource.getColumnNames(); for (String column : columnNames) { MockChartData2D data = new MockChartData2D(editor); addComponent(data); data.addToChart(MockChart.this); data.changeProperty("DataFileYColumn", column); data.changeProperty("Label", column); data.changeProperty("Source", dataFileSource.getName()); } }

Target:
public void addDataFile(MockDataFile dataFileSource) { List<String> columnNames = dataFileSource.getColumnNames(); for (String column : columnNames) { MockChartData2D data = new MockChartData2D(editor); addComponent(data); data.addToChart(this); data.changeProperty("DataFileYColumn", column); data.changeProperty("Label", column); data.changeProperty("Source", dataFileSource.getName()); } }
Source:
public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); if (arguments.length == 1 && argumentOI != null && arguments[0] != null) { String countryCode = ((StringObjectInspector) argumentOI).getPrimitiveJavaObject(arguments[0].get()); result.set(Geocode.getCountryName(countryCode)); } return result; }

Target:
public Object evaluate(DeferredObject[] arguments) throws HiveException { result.clear(); if (arguments.length == 1 && arguments[0] != null) { String countryCode = argumentOI.getPrimitiveJavaObject(arguments[0].get()); result.set(Geocode.getCountryName(countryCode)); } return result; }
Source:
private MenuItem createRefreshMenuItem() { MenuItem refreshMenuItem = new MenuItem("Refresh"); refreshMenuItem.setOnAction((e) -> { logger.info("Menu: View > Refresh"); if (ui.isNotificationPaneShowing()) { Platform.runLater(() -> { ui.triggerNotificationTimeoutAction(); ui.logic.refresh(false); }); } else { ui.logic.refresh(false); } }); refreshMenuItem.setAccelerator(REFRESH); return refreshMenuItem; }

Target:
private MenuItem createRefreshMenuItem() { MenuItem refreshMenuItem = new MenuItem("Refresh"); refreshMenuItem.setOnAction((e) -> { logger.info("Menu: View > Refresh"); if (ui.isNotificationPaneShowing()) { ui.triggerNotificationTimeoutAction(); } ui.logic.refresh(false); }); refreshMenuItem.setAccelerator(REFRESH); return refreshMenuItem; }
Source:
private LoadingCache<URI, String> createCache() { return CacheBuilder.newBuilder() .maximumSize(100) .expireAfterWrite(LIFE_SPAN_SECS - 10, TimeUnit.SECONDS) .ticker( new Ticker() { @Override public long read() { return TimeUnit.MILLISECONDS.toNanos(clock.currentTimeMillis()); } } ) .build( new CacheLoader<URI, String>() { @Override public String load(URI key) throws Exception { return generateJwtAccess(key); } } ); }

Target:
private LoadingCache<URI, String> createCache() { return CacheBuilder.newBuilder() .maximumSize(100) .expireAfterWrite(LIFE_SPAN_SECS - 300, TimeUnit.SECONDS) .ticker( new Ticker() { @Override public long read() { return TimeUnit.MILLISECONDS.toNanos(clock.currentTimeMillis()); } } ) .build( new CacheLoader<URI, String>() { @Override public String load(URI key) throws Exception { return generateJwtAccess(key); } } ); }
Source:
public byte[] compress(byte[] bytes) { try(final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) { LZFChunk chunk = encoder.get().encodeChunk(bytes, 0, bytes.length); return chunk.getData(); } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public byte[] compress(byte[] bytes) { try (final ResourceHolder<ChunkEncoder> encoder = CompressedPools.getChunkEncoder()) { final LZFChunk chunk = encoder.get().encodeChunk(bytes, 0, bytes.length); return chunk.getData(); } catch (IOException e) { log.error(e, "IOException thrown while closing ChunkEncoder."); } return null; }
Source:
public void testMapMapperOrdering() throws Exception { h.execute("insert into something (id, name) values (?, ?)", 1, "hello"); h.execute("insert into something (id, name) values (?, ?)", 2, "world"); List<Map<String, Object>> rs = h.createQuery("select id, name from something") .setMaxRows(1) .mapToMap() .list(); assertThat(rs).hasSize(2); assertThat(rs).hasOnlyElementsOfType(LinkedHashMap.class); }

Target:
public void testMapMapperOrdering() throws Exception { h.execute("insert into something (id, name) values (?, ?)", 1, "hello"); h.execute("insert into something (id, name) values (?, ?)", 2, "world"); List<Map<String, Object>> rs = h.createQuery("select id, name from something") .mapToMap() .list(); assertThat(rs).hasSize(2); assertThat(rs).hasOnlyElementsOfType(LinkedHashMap.class); }
Source:
public void testTruncateInvalidTx() throws Exception { Transaction tx1 = txClient.startLong(); Transaction tx2 = txClient.startShort(); txClient.invalidate(tx1.getWritePointer()); txClient.invalidate(tx2.getWritePointer()); ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(out), new PrintStream(err)); txAdmin.doMain(new String[]{"--truncate-invalid-tx", String.valueOf(tx2.getWritePointer())}, conf); List<String> expected = ImmutableList.of("Invalid list size before truncation: 2", "Invalid list size after truncation: 1", ""); Assert.assertEquals(Joiner.on("\n").join(expected), Bytes.toString(out.toByteArray())); Assert.assertEquals(0, err.toByteArray().length); }

Target:
public void testTruncateInvalidTx() throws Exception { Transaction tx1 = txClient.startLong(); Transaction tx2 = txClient.startShort(); txClient.invalidate(tx1.getWritePointer()); txClient.invalidate(tx2.getWritePointer()); Assert.assertEquals(2, txClient.getInvalidSize()); TransactionAdmin txAdmin = new TransactionAdmin(new PrintStream(System.out), new PrintStream(System.err)); int status = txAdmin.doMain(new String[]{"--truncate-invalid-tx", String.valueOf(tx2.getWritePointer())}, conf); Assert.assertEquals(0, status); Assert.assertEquals(1, txClient.getInvalidSize()); }
Source:
public void addVesselCrew(Person p) { addVesselCrew(Objects.requireNonNull(p), false); }

Target:
public void addVesselCrew(Person p) { addVesselCrew(p, false); }
Source:
private void adjustDesiredPosition(SolGame game) { List<SolObject> objects = game.getObjMan().getObjs(); for (SolObject object : objects) { if (object instanceof Asteroid) { Asteroid asteroid = (Asteroid) object; Vector2 fromPosition = asteroid.getPosition(); Vector2 distanceVector = SolMath.distVec(fromPosition, position); float distance = SolMath.hypotenuse(distanceVector.x, distanceVector.y); if (distance <= asteroid.getSize() && distance <= size) { if (asteroid.getSize() > size) { distanceVector.scl((asteroid.getSize() + .5f) / distance); } else { distanceVector.scl((size + .5f) / distance); } position = fromPosition.cpy().add(distanceVector); SolMath.free(SolMath.distVec(fromPosition, position)); } SolMath.free(distanceVector); } } }

Target:
private void adjustDesiredPosition(SolGame game) { List<SolObject> objects = game.getObjMan().getObjs(); for (SolObject object : objects) { if (object instanceof Asteroid) { Asteroid asteroid = (Asteroid) object; Vector2 asteroidPosition = asteroid.getPosition(); Vector2 distanceFromAsteroid = SolMath.distVec(asteroidPosition, position); float distance = SolMath.hypotenuse(distanceFromAsteroid.x, distanceFromAsteroid.y); if (distance <= asteroid.getSize() && distance <= size) { if (asteroid.getSize() > size) { distanceFromAsteroid.scl((asteroid.getSize() + .5f) / distance); } else { distanceFromAsteroid.scl((size + .5f) / distance); } position = asteroidPosition.add(distanceFromAsteroid); } SolMath.free(distanceFromAsteroid); } } }
Source:
private boolean removeService(Microservice service) { Map<String, MicroservicesRegistryImpl> microservicesRegistries = org.wso2.msf4j.internal.DataHolder.getInstance().getMicroservicesRegistries(); if (microservicesRegistries.isEmpty()) { log.error("Microservice removal failed. Microservices Registry doesn't exist to register microservice."); return false; } microservicesRegistries.values().forEach(registry -> { registry.removeService(service.getClass() .getAnnotation(Path.class).value()); registry.preDestroyService(service); }); log.info("Microservice undeployed successfully"); return true; }

Target:
private boolean removeService(Microservice service) { Map<String, MicroservicesRegistryImpl> microservicesRegistries = org.wso2.msf4j.internal.DataHolder.getInstance().getMicroservicesRegistries(); if (microservicesRegistries.isEmpty()) { log.error("Microservice removal failed. Microservices Registry doesn't exist to register microservice."); return false; } microservicesRegistries.values().forEach(registry -> { registry.removeService(service.getClass() .getAnnotation(Path.class).value()); registry.preDestroyService(service); }); log.info("Microservice undeployed successfully", service.getClass().getName()); return true; }
Source:
public List<GlusterServerService> getByServerIdAndServiceType(Guid serverId, ServiceType serviceType) { MapSqlParameterSource paramSource = getCustomMapSqlParameterSource(); paramSource.addValue("server_id", serverId); paramSource.addValue("servive_type", serviceType); return getCallsHandler().executeReadList("GetGlusterServerServicesByServerIdAndServiceType", serviceRowMapper, paramSource); }

Target:
public List<GlusterServerService> getByServerIdAndServiceType(Guid serverId, ServiceType serviceType) { MapSqlParameterSource paramSource = getCustomMapSqlParameterSource(); paramSource.addValue("server_id", serverId); paramSource.addValue("service_type", EnumUtils.nameOrNull(serviceType)); return getCallsHandler().executeReadList("GetGlusterServerServicesByServerIdAndServiceType", serviceRowMapper, paramSource); }
Source:
public void initializeTaskToolbox() throws S3ServiceException { if (taskToolbox == null) { final RestS3Service s3Client = new RestS3Service( new AWSCredentials( props.getProperty("com.metamx.aws.accessKey"), props.getProperty("com.metamx.aws.secretKey") ) ); final SegmentPusher segmentPusher = new S3SegmentPusher( s3Client, configFactory.build(S3SegmentPusherConfig.class), jsonMapper ); taskToolbox = new TaskToolbox(coordinatorConfig, emitter, s3Client, segmentPusher, jsonMapper); } }

Target:
public void initializeTaskToolbox() throws S3ServiceException { if (taskToolbox == null) { final RestS3Service s3Client = new RestS3Service( new AWSCredentials( PropUtils.getProperty(props, "com.metamx.aws.accessKey"), PropUtils.getProperty(props, "com.metamx.aws.secretKey") ) ); final SegmentPusher segmentPusher = new S3SegmentPusher( s3Client, configFactory.build(S3SegmentPusherConfig.class), jsonMapper ); taskToolbox = new TaskToolbox(coordinatorConfig, emitter, s3Client, segmentPusher, jsonMapper); } }
Source:
private boolean useInSetQueryClause(List<RexNode> disjunctions) { Set<String> leftFieldNameSet = new HashSet<>(); return disjunctions.stream().allMatch(node -> { if (node.getKind() != SqlKind.EQUALS) { return false; } RexCall call = (RexCall) node; final RexNode left = call.operands.get(0); final RexNode right = call.operands.get(1); if (right.getKind() != SqlKind.LITERAL) { return false; } String name = getLeftNodeFieldName(left); if (name == null) { return false; } leftFieldNameSet.add(name); if (leftFieldNameSet.size() != 1) { return false; } return true; }); }

Target:
private boolean useInSetQueryClause(List<RexNode> disjunctions) { if (disjunctions.size() == 0) { return false; } return disjunctions.stream().allMatch(node -> { if (node.getKind() != SqlKind.EQUALS) { return false; } RexCall call = (RexCall) node; final RexNode left = call.operands.get(0); final RexNode right = call.operands.get(1); if (right.getKind() != SqlKind.LITERAL) { return false; } String name = getLeftNodeFieldName(left); if (name == null) { return false; } return true; }); }
Source:
public void mcFooterIsPresentOnENwiki() { MixedContentFooter MCFooter = new MixedContentFooter(driver); MCFooter.openWikiMainPage().scrollToFooter(); Assertion.assertTrue(MCFooter.isMcfooterPresent()); }

Target:
public void mcFooterIsPresentOnENwiki() { MixedContentFooter mcFooter = new MixedContentFooter(); mcFooter.openWikiMainPage().scrollToMCFooter(); Assertion.assertTrue(mcFooter.isMCFooterPresent()); }
Source:
private boolean parseSwitchs(String[] args, int i) throws Exception { boolean result = false; if (checkSwitch(args, NO_USER_AGENT, i)) { HttpSender.setUserAgent(""); Constant.setEyeCatcher(""); result = true; } else if (checkSwitch(args, SP, i)) { Constant.setSP(true); result = true; } else if (checkSwitch(args, CMD, i)) { setDaemon(false); setGUI(false); } else if (checkSwitch(args, DAEMON, i)) { setDaemon(true); setGUI(false); } else if (checkSwitch(args, LOWMEM, i)) { setLowMem(true); } else if (checkSwitch(args, EXPERIMENTALDB, i)) { setExperimentalDb(true); } else if (checkSwitch(args, HELP, i)) { result = true; setGUI(false); } else if (checkSwitch(args, HELP2, i)) { result = true; setGUI(false); } else if (checkSwitch(args, VERSION, i)) { reportVersion = true; setDaemon(false); setGUI(false); } if (checkSwitch(args, NOSTDOUT, i)) { noStdOutLog = true; } return result; }

Target:
private boolean parseSwitchs(String[] args, int i) throws Exception { boolean result = false; if (checkSwitch(args, NO_USER_AGENT, i)) { HttpSender.setUserAgent(""); Constant.setEyeCatcher(""); result = true; } else if (checkSwitch(args, SP, i)) { Constant.setSP(true); result = true; } else if (checkSwitch(args, CMD, i)) { setDaemon(false); setGUI(false); } else if (checkSwitch(args, DAEMON, i)) { setDaemon(true); setGUI(false); } else if (checkSwitch(args, LOWMEM, i)) { setLowMem(true); } else if (checkSwitch(args, EXPERIMENTALDB, i)) { setExperimentalDb(true); } else if (checkSwitch(args, HELP, i)) { result = true; setGUI(false); } else if (checkSwitch(args, HELP2, i)) { result = true; setGUI(false); } else if (checkSwitch(args, VERSION, i)) { reportVersion = true; setDaemon(false); setGUI(false); } else if (checkSwitch(args, NOSTDOUT, i)) { noStdOutLog = true; } return result; }
Source:
protected LoadingCache<Credentials, String> provideTokenCache(Function<Credentials, String> getToken) { return CacheBuilder.newBuilder().expireAfterWrite(30, TimeUnit.MINUTES).build(CacheLoader.from(getToken)); }

Target:
protected LoadingCache<Credentials, String> provideTokenCache(Function<Credentials, String> getToken) { return CacheBuilder.newBuilder().expireAfterWrite(29, TimeUnit.MINUTES).build(CacheLoader.from(getToken)); }
Source:
private HttpPipeline createPipeline() { if (pipeline != null) { return pipeline; } final Configuration buildConfiguration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; final List<HttpPipelinePolicy> httpPolicies = new ArrayList<>(); final String clientName = properties.getOrDefault("name", "UnknownName"); final String clientVersion = properties.getOrDefault("version", "UnknownVersion"); final String applicationId = CoreUtils.validateApplicationId(httpLogOptions, clientOptions, new IllegalStateException("applicationId should be same in httpLogOptions and clientOptions.")); httpPolicies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); httpPolicies.add(new ServiceBusTokenCredentialHttpPolicy(tokenCredential)); httpPolicies.add(new AddHeadersFromContextPolicy()); HttpPolicyProviders.addBeforeRetryPolicies(httpPolicies); httpPolicies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); httpPolicies.addAll(userPolicies); httpPolicies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPolicyProviders.addAfterRetryPolicies(httpPolicies); return new HttpPipelineBuilder() .policies(httpPolicies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }

Target:
private HttpPipeline createPipeline() { if (pipeline != null) { return pipeline; } final Configuration buildConfiguration = configuration == null ? Configuration.getGlobalConfiguration().clone() : configuration; final List<HttpPipelinePolicy> httpPolicies = new ArrayList<>(); final String clientName = properties.getOrDefault("name", "UnknownName"); final String clientVersion = properties.getOrDefault("version", "UnknownVersion"); String logApplicationId = null; if (httpLogOptions != null) { logApplicationId = httpLogOptions.getApplicationId(); } String clientApplicationId = null; if (clientOptions != null && clientOptions.getApplicationId() != null) { clientApplicationId = clientOptions.getApplicationId(); } if (logApplicationId != null && clientApplicationId != null && !logApplicationId.equalsIgnoreCase(clientApplicationId)) { throw logger.logExceptionAsError(new IllegalStateException( "'httpLogOptions.getApplicationId() and clientOptions.getApplicationId()' cannot be different.")); } final String applicationId = clientApplicationId != null ? clientApplicationId : logApplicationId; httpPolicies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); httpPolicies.add(new ServiceBusTokenCredentialHttpPolicy(tokenCredential)); httpPolicies.add(new AddHeadersFromContextPolicy()); HttpPolicyProviders.addBeforeRetryPolicies(httpPolicies); httpPolicies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy); httpPolicies.addAll(userPolicies); httpPolicies.add(new HttpLoggingPolicy(httpLogOptions)); HttpPolicyProviders.addAfterRetryPolicies(httpPolicies); return new HttpPipelineBuilder() .policies(httpPolicies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); }
Source:
public static LogLevel fromString(String logLevelVal) { if (logLevelVal == null) { return null; } return LOG_LEVEL_STRING_MAPPER.get(logLevelVal.toLowerCase(Locale.ROOT)); }

Target:
public static LogLevel fromString(String logLevelVal) { if (logLevelVal == null) { return LogLevel.NOT_SET; } String caseInsensitiveLogLevel = logLevelVal.toLowerCase(Locale.ROOT); if (!LOG_LEVEL_STRING_MAPPER.containsKey(caseInsensitiveLogLevel)) { throw new IllegalArgumentException("We currently do not support the log level you set. LogLevel: " + logLevelVal); } return LOG_LEVEL_STRING_MAPPER.get(caseInsensitiveLogLevel); }
Source:
public void onReceivedClientCertRequest (WebView view, final ClientCertRequest request){ Logger.v(TAG + "onReceivedClientCertRequest", "onReceivedClientCertRequest"); KeyChain.choosePrivateKeyAlias(AuthenticationActivity.this, new KeyChainAliasCallback() { @Override public void alias(String alias) { try { final X509Certificate[] certChain = KeyChain.getCertificateChain( getApplicationContext(), alias); final PrivateKey privateKey = KeyChain.getPrivateKey(mCallingContext, alias); request.proceed(privateKey, certChain); } catch (KeyChainException e) { Log.e(TAG, "KeyChain exception", e); } catch (InterruptedException e) { Log.e(TAG, "KeyChain exception", e); } } }, request.getKeyTypes(), request.getPrincipals(), request.getHost(), request.getPort(), null); }

Target:
public void onReceivedClientCertRequest (WebView view, final ClientCertRequest request){ Logger.v(TAG + "onReceivedClientCertRequest", "onReceivedClientCertRequest"); KeyChain.choosePrivateKeyAlias(AuthenticationActivity.this, new KeyChainAliasCallback() { @Override public void alias(String alias) { try { final X509Certificate[] certChain = KeyChain.getCertificateChain( getApplicationContext(), alias); final PrivateKey privateKey = KeyChain.getPrivateKey(mCallingContext, alias); request.proceed(privateKey, certChain); } catch (KeyChainException e) { Log.e(TAG, "KeyChain exception", e); } catch (InterruptedException e) { Log.e(TAG, "InterruptedException exception", e); } } }, request.getKeyTypes(), request.getPrincipals(), request.getHost(), request.getPort(), null); }
Source:
public boolean isDeletable() { return printerId == UNSAVED_ID; }

Target:
public boolean isDeletable() { return printerId != UNSAVED_ID; }
Source:
public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", "cache"); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put("additional.sorts.bys", sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } return queryRequest; }

Target:
public QueryRequest createQueryRequest(String localSource, FilterBuilder filterBuilder) { List<SortBy> sortBys = sorts .stream() .filter( s -> StringUtils.isNotEmpty(s.getAttribute()) && StringUtils.isNotEmpty(s.getDirection())) .map(s -> parseSort(s.getAttribute(), s.getDirection())) .collect(Collectors.toList()); if (sortBys.isEmpty()) { sortBys.add(new SortByImpl(Result.TEMPORAL, DEFAULT_SORT_ORDER)); } Query query = new QueryImpl(createFilter(filterBuilder), start, count, sortBys.get(0), true, timeout); String source = parseSrc(localSource); QueryRequest queryRequest; if (CACHE_SOURCE.equals(source)) { queryRequest = new QueryRequestImpl(query, true); queryRequest.getProperties().put("mode", "cache"); } else { queryRequest = new QueryRequestImpl(query, Collections.singleton(source)); queryRequest.getProperties().put("mode", "update"); } if (excludeUnnecessaryAttributes) { queryRequest .getProperties() .put("excludeAttributes", Sets.newHashSet(Metacard.METADATA, "lux")); } if (sortBys.size() > 1) { queryRequest .getProperties() .put(ADDITIONAL_SORT_BYS, sortBys.subList(1, sortBys.size()).toArray(new SortBy[0])); } return queryRequest; }
Source:
public void testFull() throws Exception { Command c = new Command(IO.getJavaExecutablePath("java") + " -Dx=\"foo bar\" -version"); assertThat(c.getArguments()).containsExactly(IO.getJavaExecutablePath("java"), "-Dx=\"foo bar\"", "-version"); assertThat(c.execute(System.out, System.err)).isZero(); }

Target:
public void testFull() throws Exception { Command c = new Command("app -Dx=\"foo bar\" -version"); assertThat(c.getArguments()).containsExactly("app", "-Dx=\"foo bar\"", "-version"); c = new Command().full("app -Dx=\"foo bar\" -version"); assertThat(c.getArguments()).containsExactly("app", "-Dx=\"foo bar\"", "-version"); }
Source:
protected static boolean indexLimitReached(Index index, Map<String, Object> existingIndexes) { if (index.indexType == IndexType.TEXT) { for (String name : existingIndexes.keySet()) { Map<String, Object> existingIndex = (Map<String, Object>) existingIndexes.get(name); String type = (String) existingIndex.get("type"); if (IndexType.enumValue(type) == IndexType.TEXT && !name.equalsIgnoreCase(index.indexName)) { logger.log(Level.SEVERE, String.format("The text index %s already exists. ", name) + "One text index per datastore permitted. " + String.format("Delete %s and recreate %s.", name, index.indexName)); return true; } } } return false; }

Target:
protected static boolean indexLimitReached(Index index, Map<String, Object> existingIndexes) { if (index.indexType == IndexType.TEXT) { for (String name : existingIndexes.keySet()) { Map<String, Object> existingIndex = (Map<String, Object>) existingIndexes.get(name); IndexType type = (IndexType) existingIndex.get("type"); if (type == IndexType.TEXT && !name.equalsIgnoreCase(index.indexName)) { logger.log(Level.SEVERE, String.format("The text index %s already exists. ", name) + "One text index per datastore permitted. " + String.format("Delete %s and recreate %s.", name, index.indexName)); return true; } } } return false; }
Source:
public void waitForVoteCountChangeTimeLagToPass() { try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } }

Target:
public Post waitForVoteCountChangeTimeLagToPass() { try { Thread.sleep(2000); } catch (InterruptedException e) { PageObjectLogging.logError("waitForVoteCountChangeTimeLagToPass", e); } return this; }
Source:
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes attrs) throws SAXException { if (enabled) { try { if (isCSS(localName, attrs)) { String sheet = attrs.getValue("", "href"); if (inHead) { stylesheetsInHead.add(sheet); } else { log.debug("Inlining stylesheet link found in BODY: '{}'", sheet); inlineSheet(namespaceURI, sheet); } } else { getContentHandler().startElement(namespaceURI, localName, qName, attrs); if (localName.equalsIgnoreCase(HEAD)) { inHead = true; } else if (localName.equalsIgnoreCase(BODY)) { for (String sheet : stylesheetsInHead) { log.debug("Inlining sheet found in HEAD: '{}'", sheet); inlineSheet(namespaceURI, sheet); } } } } catch (Exception e) { log.error("Exception in stylesheet inliner", e); throw new SAXException(e); } } else { getContentHandler().startElement(namespaceURI, localName, qName, attrs); } }

Target:
public void startElement(final String namespaceURI, final String localName, final String qName, final Attributes attrs) throws SAXException { try { if (SAXElementUtils.isCSS(localName, attrs)) { String sheet = attrs.getValue("", "href"); if (!afterHeadElement) { stylesheetsInHead.add(sheet); } else { log.debug("Inlining stylesheet link found in BODY: '{}'", sheet); inlineSheet(namespaceURI, sheet); } } else { getContentHandler().startElement(namespaceURI, localName, qName, attrs); } } catch (Exception e) { log.error("Exception in stylesheet inliner", e); throw new SAXException(e); } }
Source:
public void undeploy(Object key) throws CarbonDeploymentException { if (!(key instanceof String)) { throw new CarbonDeploymentException("Error while Un Deploying : " + key + "is not a String value"); } logger.info("Undeploying : " + key); File fileToUndeploy; if (key.equals("sample1.txt")) { fileToUndeploy = new File(testDir + File.separator + key); } else if (key.equals("sample2.txt")) { fileToUndeploy = new File(testDir2 + File.separator + key); } else { throw new CarbonDeploymentException("Error while Un Deploying : " + key); } logger.info("File to undeploy : " + fileToUndeploy.getAbsolutePath()); try (FileInputStream fis = new FileInputStream(fileToUndeploy)) { int x = fis.available(); byte b[] = new byte[x]; fis.read(b); String content = new String(b); if (content.contains("sample1")) { sample1Deployed = false; } else if (content.contains("sample2")) { sample2Deployed = false; } } catch (IOException e) { throw new CarbonDeploymentException("Error while Un Deploying : " + key, e); } }

Target:
public void undeploy(Object key) throws CarbonDeploymentException { if (!(key instanceof String)) { throw new CarbonDeploymentException("Error while Un Deploying : " + key + "is not a String value"); } logger.info("Undeploying : " + key); File fileToUndeploy; if ("sample1.txt".equals(key)) { fileToUndeploy = new File(testDir + File.separator + key); } else if ("sample2.txt".equals(key)) { fileToUndeploy = new File(testDir2 + File.separator + key); } else { throw new CarbonDeploymentException("Error while Un Deploying : " + key); } logger.info("File to undeploy : " + fileToUndeploy.getAbsolutePath()); try (FileInputStream fis = new FileInputStream(fileToUndeploy)) { int x = fis.available(); byte b[] = new byte[x]; fis.read(b); String content = new String(b); if (content.contains("sample1")) { sample1Deployed = false; } else if (content.contains("sample2")) { sample2Deployed = false; } } catch (IOException e) { throw new CarbonDeploymentException("Error while Un Deploying : " + key, e); } }
Source:
private TimeValue getTimeValue(JSONObject jsonTimeValue) throws JSONException { TimeValue result; String stringTime = jsonTimeValue.getString("time"); String[] substrings = stringTime.split("(?<!\\A)[\\-\\:TZ]"); long year = Long.parseLong(substrings[0]); byte month = Byte.parseByte(substrings[1]); byte day = Byte.parseByte(substrings[2]); byte hour = Byte.parseByte(substrings[3]); byte minute = Byte.parseByte(substrings[4]); byte second = Byte.parseByte(substrings[5]); byte precision = (byte) jsonTimeValue.getInt("precision"); int beforeTolerance = jsonTimeValue.getInt("before"); int afterTolerance = jsonTimeValue.getInt("after"); int timezoneOffset = jsonTimeValue.getInt("timezone"); String calendarModel = jsonTimeValue.getString("calendarmodel"); result = this.factory.getTimeValue(year, month, day, hour, minute, second, precision, beforeTolerance, afterTolerance, timezoneOffset, calendarModel); return result; }

Target:
private TimeValue getTimeValue(JSONObject jsonTimeValue) throws JSONException { String stringTime = jsonTimeValue.getString("time"); String[] substrings = stringTime.split("(?<!\\A)[\\-\\:TZ]"); long year = Long.parseLong(substrings[0]); byte month = Byte.parseByte(substrings[1]); byte day = Byte.parseByte(substrings[2]); byte hour = Byte.parseByte(substrings[3]); byte minute = Byte.parseByte(substrings[4]); byte second = Byte.parseByte(substrings[5]); byte precision = (byte) jsonTimeValue.getInt("precision"); int beforeTolerance = jsonTimeValue.getInt("before"); int afterTolerance = jsonTimeValue.getInt("after"); int timezoneOffset = jsonTimeValue.getInt("timezone"); String calendarModel = jsonTimeValue.getString("calendarmodel"); return this.factory.getTimeValue(year, month, day, hour, minute, second, precision, beforeTolerance, afterTolerance, timezoneOffset, calendarModel); }
Source:
public void startup() { initServerBootstrap(); ChannelFuture channelFuture; if (!Strings.isNullOrEmpty(configuration.getHost())) { channelFuture = serverBootstrap.bind(configuration.getHost(), configuration.getPort()); } else { channelFuture = serverBootstrap.bind(configuration.getPort()); } channelFuture.addListener(future -> { if (future.isSuccess()) { log.info("Restful Service started on port {}.", configuration.getPort()); } else { log.error("", future.cause()); } }); }

Target:
public void startup() { initServerBootstrap(); ChannelFuture channelFuture; if (!Strings.isNullOrEmpty(configuration.getHost())) { channelFuture = serverBootstrap.bind(configuration.getHost(), configuration.getPort()); } else { channelFuture = serverBootstrap.bind(configuration.getPort()); } channelFuture.addListener(future -> { if (future.isSuccess()) { log.info("Restful Service started on port {}.", configuration.getPort()); } else { log.error("Failed to start Restful Service.", future.cause()); } }); }
Source:
public DeleteObjectsResult deleteObjects( DeleteObjectsRequest deleteObjectsRequest) throws AmazonClientException, AmazonServiceException { for (DeleteObjectsRequest.KeyVersion keyVersion : deleteObjectsRequest.getKeys()) { registerDeleteObject(keyVersion.getKey(), deleteObjectsRequest .getBucketName()); } maybeFail(); return super.deleteObjects(deleteObjectsRequest); }

Target:
public DeleteObjectsResult deleteObjects(DeleteObjectsRequest deleteObjectsRequest) throws AmazonClientException, AmazonServiceException { maybeFail(); for (DeleteObjectsRequest.KeyVersion keyVersion : deleteObjectsRequest.getKeys()) { registerDeleteObject(keyVersion.getKey(), deleteObjectsRequest.getBucketName()); } return super.deleteObjects(deleteObjectsRequest); }
Source:
public static Optional<ErrorType> fromByte(byte value) { switch (value) { case (byte) 0x00: return Optional.of(Invalid); case (byte) 0x01: return Optional.of(Timeout); case (byte) 0x02: return Optional.of(Cancelled); case (byte) 0x03: return Optional.of(Busy); case (byte) 0x04: return Optional.of(Declined); case (byte) 0x05: return Optional.of(UnexpectedError); case (byte) 0x06: return Optional.of(BadRequest); case (byte) 0x07: return Optional.of(NetworkError); case (byte) 0x08: return Optional.of(Unhealthy); case (byte) 0xff: return Optional.of(FatalProtocolError); default: return Optional.empty(); } }

Target:
public static ErrorType fromByte(byte value) { switch (value) { case (byte) 0x00: return Invalid; case (byte) 0x01: return Timeout; case (byte) 0x02: return Cancelled; case (byte) 0x03: return Busy; case (byte) 0x04: return Declined; case (byte) 0x05: return UnexpectedError; case (byte) 0x06: return BadRequest; case (byte) 0x07: return NetworkError; case (byte) 0x08: return Unhealthy; case (byte) 0xff: return FatalProtocolError; default: return null; } }
Source:
public HttpProtocolAwareExceptionTranslator(AtlasDbHttpProtocolHandler<E> httpProtocolHandler) { this.httpProtocolHandler = httpProtocolHandler; }

Target:
HttpProtocolAwareExceptionTranslator(AtlasDbHttpProtocolHandler<E> httpProtocolHandler) { this.httpProtocolHandler = httpProtocolHandler; }